-- create table areas(
-- aid int primary key,
-- atitle varchar(20),
-- pid int
-- );
-- insert into areas
-- values ('130000', '河北省', NULL),
-- ('130100', '石家庄市', '130000'),
-- ('130400', '邯郸市', '130000'),
-- ('130600', '保定市', '130000'),
-- ('130700', '张家口市', '130000'),
-- ('130800', '承德市', '130000'),
-- ('410000', '河南省', NULL),
-- ('410100', '郑州市', '410000'),
-- ('410300', '洛阳市', '410000'),
-- ('410500', '安阳市', '410000'),
-- ('410700', '新乡市', '410000'),
-- ('410800', '焦作市', '410000');
-- (p 省 c 市 a 区 选择条件 就是找一个正确的 找一条错误的 看一下连接关系)
-- 查询一共有多少个省
-- select count(*) from areas where pid is null;
-- 查询河南省的所有城市
-- select *from areas as p inner join areas as c on c.pid=p.aid where p.atitle='河南省';
-- insert into areas values
-- ('410101', '中原区', '410100'),
-- ('410102', '二七区', '410100'),
-- ('410103', '金水区', '410100');
-- 查询郑州市的所有区县
-- select * from areas as c inner join areas as a on a.pid=c.aid where c.atitle='郑州市';
-- 查询河南省的所有区县
-- select * from areas as p left join areas as c on c.pid=p.aid
-- left join areas as a on a.pid=c.aid where p.atitle='河南省'