有用的sql语句积累

⑴.  sql查询未被外键关联的数据
    select * from bb b where not exists (select 1 from aa a where a.bid=b.bid)

原文地址:https://www.cnblogs.com/hahajava/p/9103420.html