鉴于此表结构和示例数据(查询中不应使用 t3,此处仅显示 t1 和 t2 之间的关系):
t1 t2 t3
-------------- ----------------- --------------------------------
| id | value | | t1key | t3key | | id | value |
| 1 | 2008 | | 3 | 1 | | 1 | "New intel cpu in 2010" |
| 2 | 2009 | | 4 | 1 | | 2 | "New amd cpu in 2008" |
| 3 | 2010 | | 6 | 1 | | | ... |
| 4 | intel | | 1 | 2 | --------------------------------
| 5 | amd | | 5 | 2 |
| 6 | cpu | | 6 | 2 |
| | ... | | | ... |
-------------- -----------------
您将如何构建满足以下条件的 SQL 查询:
Given the input for t1.id is the set {6} returns t1.id set {3,4,6,1,5}
Given the input for t1.id is the set {6,4} returns t1.id set {3,4,6}
Given the input for t1.id is the set {5,4} returns t1.id set {}
当桌子更大时不会影响性能......?