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.)
更多请看下节:https://blog.youkuaiyun.com/qq_44591615/article/details/109204925
本文深入探讨了 SQL 中 EXISTS 子查询的使用方法,通过具体示例展示了如何利用 EXISTS 检测行的存在,从而高效地从 student 表中筛选出所有在 register 表中有匹配记录的学生姓名。
1万+





