您的位置首页百科问答

SQL中EXISTS怎么用

SQL中EXISTS怎么用

的有关信息介绍如下:

SQL中EXISTS怎么用

EXISTS 是判断是否存在,和in类似,但效率要比in高SELECT * FROM EMP (基础表) WHERE EMPNO > 0 AND EXISTS (SELECT 'X' FROM DEPT WHERE DEPT.DEPTNO = EMP.DEPTNO AND LOC = 'MELB')SELECT * FROM EMP (基础表) WHERE EMPNO > 0 AND DEPTNO IN(SELECT DEPTNO FROM DEPT WHERE LOC = 'MELB')