sql 行子查询

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 行子查询相关的知识,希望对你有一定的参考价值。

\!h Find an engineer who has also been a producer, for the same amount of time:
SELECT producer_name, years FROM producer WHERE
(producer_name, years) IN -- where prod name and years matches eng name and years
(SELECT engineer_name, years FROM engineer);

\!h Equivalent as a join query to compare:
SELECT producer_name, producer.years FROM -- show prod names and years from prod and eng table
producer, engineer WHERE producer_name = engineer_name -- where prod name = eng name
AND producer.years = engineer.years -- and prod years = eng years

以上是关于sql 行子查询的主要内容,如果未能解决你的问题,请参考以下文章

sql4

求SQL相关子查询和嵌套子查询通俗的区别 ?

SQL ROW 子查询中比较的顺序定义?

SQL问题,子查询返回的值不止一个!

MySQL随记 - 子查询

多表查询