40 Subqueries
SELECT *
FROM products
WHERE unit_price >
(SELECT unit_price
FROM products
WHERE product_id = 3)
## 筛选价格比莴笋贵的物品
SELECT *
FROM employees
WHERE salary >
(SELECT AVG(salary)
FROM employees)
## 筛选员工工资比平均高的
41 The IN Operator
- 使用subqueries的syntax
SELECT *
FROM clients
WHERE client_id NOT IN
(SELECT DISTINCT client_id
FROM invoices)
## 找出没有开发票的客户
网友评论