<>力扣sql基础篇(五)
<>1 页面推荐
<>1.1 题目内容
<>1.1.1 基本题目信息
<>1.1.2 示例输入输出
<>a 输入示例
<>b 输出示例
<>1.2 示例sql语句
# Write your MySQL query statement below SELECT distinct page_id
recommended_pageFROM Likes WHERE (user_id in ( SELECT user2_id FROM Friendship
WHERE user1_id=1 ) OR user_id in ( SELECT user1_id FROM Friendship WHERE
user2_id=1 ) ) AND page_id NOT in ( SELECT page_id FROM Likes WHERE user_id=1 )
<>1.3 运行截图
<>2 至少有五名直接下属的经理
<>2.1 题目内容
<>2.1.1 基本题目信息
<>2.1.2 示例输入输出
<>2.2 示例sql语句
SELECT name FROM Employee WHERE id in ( SELECT managerId FROM Employee GROUP BY
managerIdHAVING count(*)>=5 )
<>2.3 运行截图
<>3 求团队人数
<>3.1 题目内容
<>3.1.1 基本题目信息
<>3.1.2 示例输入输出
<>3.2 示例sql语句
SELECT e.employee_id,t.team_size FROM Employee e INNER JOIN ( SELECT team_id,
count(team_id) team_size FROM Employee GROUP BY team_id )t ON e.team_id=t.
team_id
<>3.3 运行截图