Three tables are connected. Field a of table A corresponds to field b of table B, and field b1 of table B corresponds to field c of table C. Now create a view to see all the information of the three tables at the same time. create or replace view v_name as select t1.*,t2.*,t3.* from table A t1, table B t2, table C t3 where t1.a=t2.b and t2.b1=t3.c Create a view by linking two tables CREATE TABLE `aa_user` ( `id` int(10) NOT NULL, `name` varchar(10) DEFAULT NULL, `age` int(10) DEFAULT NULL, PRIMARY KEY (`id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `aa_user` VALUES ('1', 'zs', '18'); INSERT INTO `aa_user` VALUES ('2', 'ls', '20'); INSERT INTO `aa_user` VALUES ('3', 'ww', '19'); CREATE TABLE `tb` ( `id` int(10) NOT NULL, `fid` int(10) DEFAULT NULL, `cc` int(10) DEFAULT NULL, PRIMARY KEY (`id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `tb` VALUES ('1', '1', '60'); INSERT INTO `tb` VALUES ('2', '1', '70'); INSERT INTO `tb` VALUES ('3', '2', '80'); INSERT INTO `tb` VALUES ('4', '2', '90'); Creating a View CREATE or REPLACE view aa_ta_view AS select a.*,b.fid,b.cc from aa_user a,tb b where a.id = b.fid; You may also be interested in:
|
>>: How to use Vue to develop public account web pages
1 Download the MySQL 5.6 version compressed packa...
This article records the detailed installation tu...
describe: Install VM under Windows 10, run Docker...
Since I used this plugin when writing a demo and ...
CSS (Cascading Style Sheet) is used to beautify H...
Preface: Fully encapsulating a functional module ...
Table of contents 1. filter() 2. forEach() 3. som...
I was working on a pop-up ad recently. Since the d...
The cause is that the process opens a number of f...
Preface Using Docker and VS Code can optimize the...
This tutorial shares the specific code of MySQL5....
About Docker Swarm Docker Swarm consists of two p...
Table of contents need: drive: Ideas: accomplish:...
When MySQL queries tens of millions of data, most...
Preview address: https://ovsexia.gitee.io/leftfix...