标签:字符 jobs esc 添加 查找 obs evel 城市 mis
FROM employees,departments WHERE employees.department_id=departments.department_id; #案例3:查询员工名,工种号,工种名 #为表名起别名,简洁,一旦使用了别名,则不能使用原来的表名了。 SELECT last_name,e.job_id,job_title FROM employees e,jobs j WHERE e.job_id = j.job_id; #4,可以加筛选吗? #案例;查询有奖金的员工名,部门名 SELECT last_name,department_name FROM employees e,departments d WHERE e.department_id = e.department_id && e.commission_pct is not null; #5,查询城市名中第二个字符为o的部门名和城市名 # 可以添加筛选条件的。 SELECT department_name,city FROM departments d,locations l WHERE d.location_id = l.location_id && l.city like ‘_o%‘; #可以添加分组吗? #案例1:查询每个城市的部门个数 SELECT COUNT(*) 个数,city FROM departments d,locations l WHERE d.location_id = l.location_id GROUP BY city; #案例2 #查询有奖金的每一个部门名和部门领导编号,和该部门的最低工资 SELECT d.department_name,MIN(e.salary) FROM departments d,employees e WHERE d.department_id = e.department_id && e.commission_pct is not NULL GROUP BY department_name; #案例3:查询每个工种名和员工个数,并且按照员工个数降序。 SELECT job_title,COUNT(*) FROM employees e,jobs j WHERE e.job_id = j.job_id GROUP BY job_title ORDER BY COUNT(*) DESC;
#2,非等值查询 #案例1,查询员工的工资和工资级别 SELECT * FROM job_grades; SELECT salary,grade_level FROM employees e,job_grades g WHERE salary BETWEEN g.lowest_sal AND g.highest_sal;
标签:字符 jobs esc 添加 查找 obs evel 城市 mis
原文地址:https://www.cnblogs.com/dazhu123/p/12593579.html