标签:外连接 class 1.2 inner 类型 筛选 sql基础 like select
select 查询列表 from 表1 [连接类型] join 表2 on 连接条件 where 筛选条件;
select 查询列表 from 表1 inner join 表2 on 连接条件 [where 筛选条件];
SELECT e.last_name, d.department_name FROM employees e INNER JOIN departments d ON e.department_id = d.department_id;
SELECT e.last_name, j.job_title FROM employees e INNER JOIN jobs j ON e.job_id = j.job_id WHERE e.last_name LIKE ‘%e%‘;
SELECT l.city, count(*) `count` FROM departments d INNER JOIN locations l ON d.location_id = l.location_id GROUP BY l.city HAVING `count` > 3;
SELECT d.department_name, count(*) 员工个数 FROM employees e INNER JOIN departments d ON e.department_id = d.department_id GROUP BY d.department_name HAVING 员工个数 > 3;
SELECT e.last_name 员工名, d.department_name 部门名, j.job_title 工种名 FROM employees e INNER JOIN departments d INNER JOIN jobs j ON e.department_id = d.department_id AND e.job_id = j.job_id ORDER BY 部门名;
标签:外连接 class 1.2 inner 类型 筛选 sql基础 like select
原文地址:https://www.cnblogs.com/xuweiweiwoaini/p/9533062.html