一,数据库表的基本结构
关系结构数据库以表格(Table)进行数据存储,表格由“行”和”列“组成
二,基本查询
语法:select列名from表名
1,查询t_employees表中员工姓名和工资
select last_name,salary from t_employees
2,查询员工所有的信息*表示所有的列(在实际开发当中 不能使用*)
select * from t_employees
①在基本查询当中可以进行四则运算
1,查询员工的年薪 奖金*12
select last_name,salary*12 from t_employees
2,查询员工的月薪 基础工资扣除800=月薪
select last_name,salary-800 from t_employees
3,查询所有员工的工资(扣除社保800 + 绩效)
ifnull(判断的字段值,如果为null)
select last_name,salary*IFNULL(COMMISSION_PCT,0)+salary-800 from t_employees
4,查询员工绩效
select last_name,salary*COMMISSION_PCT from t_employees
5,查询员工的时薪
select last_name,salary/22/8 from t_employees;