select * from tb_emp;#查询表里的所有东西
select name,id,title,salary from tb_emp;#查询表的名字,头部,工资
select id as emp_id,name,salary from tb_emp;#取别名:把id的名字变为emp_id并且查询姓名工资
select id 工号,name 姓名,salary 工资 from tb_emp;#id,name,salary的头部名字分别变为工号,名字,工资
select id 工号,name 姓名,salary*12 工资 from tb_emp;#id,name,salary的头部名字分别变为工号,名字,工资。并且查询一年的工资
select id,name,salary*12 sal_year from tb_emp;#给一年里的工资头部取别名为sal_year
select title from tb_emp;#专门查询表里的title
select DISTINCT title from tb_emp;#查询title的过程没有出现重复
select * from tb_emp where title='Stock Clerk';#查询表中title为"stock clerk"的员工信息
select * from tb_emp where dept_id='7';#查询表中dept_id为"7"的员工信息
select * from tb_emp where salary>=2500 and salary<=3300 and title='Stock Clerk';#查询表中工资大于2500且小于3300元,title为"stock clerk"的员工信息
select * from tb_emp where salary between 2500 and 3300 and title='Stock Clerk';#同上
select * from tb_emp where salary not between 2500 and 3300;#查询表中员工的工资不在2500到3300内
select * from tb_emp where dept_id in (1,3,7,9);#查询dept_id内有1,3,7,9的员工信息
select * from tb_emp where dept_id not in (1,3,7,9);#查询dept_id内没有1,3,7,9的员工信息
select * from tb_emp where name like 'M_i';#查询名字只有三个字母并且第一个字母为m最后一个字母为i
select * from tb_emp where salary like'%4%';#查询表里的工资里面的数字有4这个数字
select * from tb_emp where salary>3500 order by salary;#查询工资大于3500以上并且是升序
select * from tb_emp where dept_id = 2 order by salary desc ,name;#