EXISTS 在SQL语句中怎么用?

EXISTS
指定一个子查询,检测行的存在。

SELECT DISTINCT name
FROM student
WHERE EXISTS
(SELECT *
FROM register
WHERE id = student.id);

(note that if some rows in student register.id =student.id, all those rows in student are selected out.)

详情请见:http://www.mark-to-win.com/index.html?content=Mydb/DBUrl.html&chapter=Mydb/DBIntroduction_web.html#ExistOper

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/84494312