#案例:选中city在多伦多工作的员工
SELECT
last_name,job_id,e.department_id,department_name
FROM
employees AS e,departments AS d,locations AS l
WHERE
e.`department_id`=d.`department_id`
AND
d.`location_id`=l.`location_id`
AND
l.city='Toronto'
#案例;查询每个国家下的部门个数大于2的国家编号
SELECT
country_id ,COUNT(*)
FROM
locations AS l,departments AS d
WHERE
l.`location_id`=d.`location_id`
GROUP BY
country_id
HAVING
COUNT(*) >2;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。