当前位置:Gxlcms > 数据库问题 > 第四十六天上课 MySQL高级查询

第四十六天上课 MySQL高级查询

时间:2021-07-01 10:21:17 帮助过:3人阅读

               select * from 表名,表名 where 表名.列名=表名.列名

join on连接:  select * from 表名 join 表名        #join连接,结果也是笛卡尔积 

               select * from 表名 join 表名 on 表名.列名=表名.列名

联合查询:     select 列名,列名 from 表名 union select 列名,列名 from 表名       #两个查询列必须相同

无关子查询:   select * from 表名 where 列名=(select 列名 from 表名 where 列名=‘’)    #子查询被父查询使用,子查询能单独执行

相关子查询:   select * from car a where oil<(select avg (oil)from car b where a.brand = b.brand )   

       

第四十六天上课 MySQL高级查询

标签:

人气教程排行