页: 1
------------------------------
| employee |
------------------------------
| employee_id | employee_name |
------------------------------
| 1 | one |
| 2 | two |
| 3 | three |
------------------------------
以及
-------------------------------------------
| feedback |
-------------------------------------------
| employee_id (FK) | comments |
-------------------------------------------
| 2 | comment two |
-------------------------------------------
遣返所有雇员的最佳(业绩)方式是: 他们是否得到反馈?
我想到的是以下表格,但由于它使用分类,我不清楚这两个表格的记录数量在增加时会如何加快。
SELECT * FROM employee WHERE employee_id NOT IN (SELECT employee_id FROM feedback)
The database is Oracle 以及 all key columns have indexes.
Update
感谢大家,我希望我接受不止一个答案! 这是我在最后使用的(我与其他几张表格一样,我的表结构非常简单。
SELECT
e.name, m.name, a.postcode
FROM
employee LEFT OUTER JOIN feedback f on (e.employee_id = f.employee_id),
address a, manager m
WHERE a.address_id = e.address_id
AND m.manager_id = e.manager_id
AND f.employee_id IS NULL