mysql左连接、右连接和内连接_MySQL
时间:2021-07-01 10:21:17
帮助过:5人阅读
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. 外连接