mysql 左连接、右连接和内连接_MySQL
程序员文章站
2024-02-15 11:52:29
...
bitsCN.com
脚本如下:
drop table table1;
CREATE TABLE `andrew`.`table1`
(
`name` VARCHAR(32) NOT NULL,
`city` VARCHAR(32) NOT NULL
)
ENGINE = MyISAM;
insert into TABLE1(name, city) values ('Person A', 'BJ');
insert into TABLE1(name, city) values ('Person B', 'BJ');
insert into TABLE1(name, city) values ('Person C', 'SH');
insert into TABLE1(name, city) values ('Person D', 'SZ');
commit;
drop table table2;
CREATE TABLE `andrew`.`table2`
(
`name` VARCHAR(32) NOT NULL,
`city` VARCHAR(32) NOT NULL
)
ENGINE = MyISAM;
insert into TABLE2(name, city) values ('Person W', 'BJ');
insert into TABLE2(name, city) values ('Person X', 'SH');
insert into TABLE2(name, city) values ('Person Y', 'SH');
insert into TABLE2(name, city) values ('Person Z', 'NJ');
commit;
1. 外连接
drop table table1;
CREATE TABLE `andrew`.`table1`
(
`name` VARCHAR(32) NOT NULL,
`city` VARCHAR(32) NOT NULL
)
ENGINE = MyISAM;
insert into TABLE1(name, city) values ('Person A', 'BJ');
insert into TABLE1(name, city) values ('Person B', 'BJ');
insert into TABLE1(name, city) values ('Person C', 'SH');
insert into TABLE1(name, city) values ('Person D', 'SZ');
commit;
drop table table2;
CREATE TABLE `andrew`.`table2`
(
`name` VARCHAR(32) NOT NULL,
`city` VARCHAR(32) NOT NULL
)
ENGINE = MyISAM;
insert into TABLE2(name, city) values ('Person W', 'BJ');
insert into TABLE2(name, city) values ('Person X', 'SH');
insert into TABLE2(name, city) values ('Person Y', 'SH');
insert into TABLE2(name, city) values ('Person Z', 'NJ');
commit;
1. 外连接
上一篇: Thinkphp返回上一页的实现方案
下一篇: phpCMS简单有关问题