企业部门表员工表建表sql带数据;mysql练手sql语句集合,带讲义;
计算员工的年薪;列出员工的编号,姓名和年薪
> select empno, ename, sal*12 as yearsal
> from emp;
计算部门平均薪水;列出部门编号,部门名和平均薪水
```sql
select t.deptno,dept.dname, t.avgsal
from (select deptno, avg(sal) as avgsal
from
创建部门表
create table if not exists dept(
deptno int,
dname string,
loc int
)
row format delimited fields terminated by '\t';
创建员工表
create table if not exists emp(
empno int,
ename string,
job string,
mgr int,
hiredate string,
sal double,
comm double,
d