阅读背景:

Mysql多表查询,子查询

来源:互联网 
select * from t11,t16 where t11.id=t16.id; select * from t11 t,t16 tt where t.id=tt.id; #笛卡尔集 会出问题 select * from t11 t,t16; #内链接 select * from t11 INNER JOIN t16 on t11.id=t16.id; #左链接 select * from t11 LEFT OUTER JOIN t16 on t11.id = t16.id; #右链接 select * from t11 RIGHT OUTER JOIN t16 on t11.id = t16.id; #子查询 select * from t11 where t11.age > ANY (select age from t16); #机器出现故障的时候才查询log日志 先执行后面的代码 在执行前面的代码 not exists 也是如此 select * from lg where category ='Nginx' and exists (select * from state where Nginx='fail'); #in 子查询 select * from t11 where t11.id in (select id from t16); #union 子查 唯一性操作 取唯一去重 select * from t11 union select * from t16; #简单的两张表拼接在一起 select * from t11 union all select * from t16; select * from t11,t16 where t11.id=t16.id; select



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: