输入banner图图片脚本导航/分类

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

               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高级查询

标签: