#建立一个数据库

create database why;

#新建一个用户表

create table why(employee_id bigint,name char(16),gerder enum('M','F'),dept_id enum('caiwu','renshi','shichang','jishu'),join_time date,salary double,phone char(11),address char(40),description text);

#建立用户记录

insert into why values(20121200*(#序号),'name','F/M','caiwu/renshi/shichang/jishu','2012-10-07,*(#工资),'*'(#电话),'address','description')

#实现sql查询
    按名字查找
    select * from why where name='name'; #查找某个人的个人信息
    按照薪水>查找
    select * from why where salary>=3000 and salary<=10000;#查找薪水高于3000(含3000)     低于1w(含10000)的所有人
    查找每个部门的人数
    select dent_id,count(*) as dentsum from why group by dept_id;
    每个部门的平均薪资
    select dent_id,avg(salary) as avgsalary from why group by dept_id;
    描述字段为空的员工
    select * from why where description is null; #所有信息均为空(包括用户姓名) 

    select * from why where description='';#只有描述信息为空

    求出每个部门女员工工资最高的职工的薪水
    select dept_id max(salary) from why where gerder='F' group by dept_id;
    名字以l开头的员工个数
    select * from why where name like "l%"