596. 超过5名学生的课
2.编写一个SQL查询来报告 至少有5个学生 的所有班级。
以 任意顺序 返回结果表。
查询结果格式如下所示。
SELECT
class
FROM
(SELECT
class, COUNT(DISTINCT student) AS num
FROM
courses
GROUP BY class) AS temp_table
WHERE
num >= 5
;
1757. 可回收且低脂的产品
SELECT
product_id
FROM
Products
WHERE
low_fats = 'Y'
AND
recyclable = 'Y'
584. 寻找用户推荐人
SELECT
name
FROM
customer
where IFNULL( referee_id,0) !=2
183. 从不订购的客户
select customers.name as 'Customers'
from customers
where customers.id not in
(
select customerid from orders
);