查询locations表中,所有的country_id(去重)
select DISTINCT country_id from locations;
选择员工姓名的第三个字母是a的员工姓名和年薪
select last_name,salary*12 as 年薪
from employees
where last_name LIKE '__a%';
查询employees表中,雇用时间在2004-02-06~2014-03-05之间的员工姓名与工号
select last_name,employee_id
from employees
where hiredate BETWEEN '2004-02-06' AND '2014-03-05';
扩展题:将上题条件改为在2004~2014之间
select last_name,employee_id
from employees
where year(hiredate) BETWEEN '2004' and '2014'
查询locations表中,城市不在Roma、Tokyo、Seattle的城市和街道地址信息,要求为城市起对应的中文别名
select city as 城市,street_address
from locations
where city not in('Roma','Tokyo','Seattle')
选择公司中没有管理者的员工姓名及job_id
select last_name,job_id
from employees
where manager_id is null
显示出表employees表中first_name以’e’结尾的员工信息
select *
from employees
where first_name like '%e'