数据库SQL实战15:查找employees表

思想:

题目要求查找employees表所有emp_no为奇数,且last_name不为Mary的员工信息,并按照hire_date逆序排列。首先通过条件(emp_no%2)=1找出所有奇数的emp_no,其次通过条件last_name!='Mary'找出last_name不为Mary的员工,最后通过条件order by hire_date desc实现按照hire_date逆序排序。

select * from employees where (emp_no%2)=1 and last_name!='Mary' order by hire_date desc;

猜你喜欢

转载自blog.csdn.net/weixin_43160613/article/details/83684828