Mysql--自关联、子查询

**自关联,表:省份、城市、县级区都有id、name共同属性,可以建立一张卡,
id、name、pid **
查询山东省有哪些城市

select province.name,city.name from areas as province inner join areas as city on city.pid=provice.id having provice.name='山东省';

子查询(速度慢点)

查询最高男生信息
select * from student where height=(select max(height) from student );

发布了49 篇原创文章 · 获赞 3 · 访问量 2082

猜你喜欢

转载自blog.csdn.net/darling_user/article/details/101945830
今日推荐