OceanBase 存在条件
存在条件(EXISTS Conditions)用于测试子查询中是否存在指定的行。
语法
EXISTS (subquery)
如果子查询至少返回一行,则说明存在您想要的数据。
示例
SELECT department_id FROM departments d WHERE EXISTS (SELECT * FROM employees e
WHERE d.department_id = e.department_id) ORDER BY department_id;