复制代码 代码如下:
SELECT c.CustomerId, CompanyName
FROM Customers c
WHERE EXISTS(
SELECT OrderID FROM Orders o
WHERE o.CustomerID = cu.CustomerID)
复制代码 代码如下:
SELECT CategoryName
FROM Categories
WHERE EXISTS (SELECT NULL)
ORDER BY CategoryName ASC
复制代码 代码如下:
SELECT DISTINCT pub_name
FROM publishers
WHERE EXISTS
(SELECT *
FROM titles
WHERE pub_id = publishers.pub_id
AND type = /'business/')
复制代码 代码如下:
SELECT distinct pub_name
FROM publishers
WHERE pub_id IN
(SELECT pub_id
FROM titles
WHERE type = /'business/')
复制代码 代码如下:
SELECT au_lname, au_fname
FROM authors
WHERE exists
(SELECT *
FROM publishers
WHERE authors.city = publishers.city)
复制代码 代码如下:
SELECT au_lname, au_fname
FROM authors
WHERE city = ANY
(SELECT city
FROM publishers)
复制代码 代码如下:
SELECT title
FROM titles
WHERE EXISTS
(SELECT *
FROM publishers
WHERE pub_id = titles.pub_id
AND city LIKE /'B%/')
复制代码 代码如下:
SELECT title
FROM titles
WHERE pub_id IN
(SELECT pub_id
FROM publishers
WHERE city LIKE /'B%/')
复制代码 代码如下:
SELECT pub_name
FROM publishers
WHERE NOT EXISTS
(SELECT *
FROM titles
WHERE pub_id = publishers.pub_id
AND type = /'business/')
ORDER BY pub_name
复制代码 代码如下:
select distinct 姓名 from xs
where not exists (
select * from kc
where not exists (
select * from xs_kc
where 学号=xs.学号 and 课程号=kc.课程号
)
复制代码 代码如下:
where not exists
select * from xs_kc
where 学号=xs.学号 and 课程号=kc.课程号
新闻热点
疑难解答