1. 查询多个字段
      SELECT 字段1,字段2,字段3,….,字段n FROM 表名 ;
      SELECT * FROM 表名;

    2. 设置别名
      SELECT 字段1 as 别名1,字段2 as 别名2,字段3 as 别名3,….,字段n as 别名n FROM 表名 ;

    3. 去除重复记录
      SELECT DISTINCT 字段列表 FROM 表名;

    注意 : * 号代表查询所有字段,在实际开发中尽量少用(不直观、影响效率)。

    数据准备:
    create table emp(
    id int comment ‘编号’,
    workno varchar(18) comment ‘工号’,
    name varchar(18) comment ‘姓名’,
    gerder char(1) comment ‘性别’,
    age tinyint unsigned comment ‘年龄’,
    idcard char(18) comment ‘身份证号’,
    workaddress varchar(50) comment ‘工作地址’,
    entrydate date comment ‘入职时间’
    )comment ‘员工表’;

    insert into emp( id,workno,name,gerder,age,idcard, workaddress,entrydate)
    values
    (1,’1’,’张飞’,’男’,30,’433127000000000001’,’蜀国’,’2020-10-01’),
    (2,’2’,’关羽’,’男’,33,’433127000000000002’,’蜀国’,’2021-01-01’),
    (3,’3’,’刘备’,’男’,54,’433127000000000003’,’蜀国’,’2019-06-07’),
    (4,’4’,’黄忠’,’男’,60,’433127000000000004’,’蜀国’,’2020-03-12’),
    (5,’5’,’马超’,’男’,25,’433127000000000005’,’蜀国’,’1990-05-10’),
    (6,’6’,’赵云’,’男’,20,’433127000000000006’,’蜀国’,’2000-03-11’),
    (7,’7’,’大乔’,’女’,18,’433127000000000007’,’吴国’,’1996-02-21’),
    (8,’8’,’小乔’,’女’,16,’433127000000000008’,’吴国’,’1998-06-11’),
    (9,’9’,’貂蝉’,’女’,20,’433127000000000009’,’魏国’,’2012-03-29’),
    (10,’10’,’蔡文姬’,’女’,20,’433127000000000010’,’魏国’,’2013-06-25’),
    (11,’11’,’曹操’,’男’,50,’433127000000000011’,’魏国’,’2016-01-22’),
    (12,’12’,’曹植’,’男’,20,null,’魏国’,’2018-07-16’)

    课堂练习操作:
    1、查询所有数据
    select from emp;(开发中尽量不要用去查询,1.不直观,2.会影响效率)
    select id,workno,name,gerder,age,idcard, workaddress,entrydate from emp;
    2、查询指定字段(name,age,idcard)
    select name,age,idcard from emp;
    3、查询所有员工工作地址,起别名
    select workaddress as ‘工作地址’ from emp;
    select workaddress ‘工作地址’ from emp;
    4、查询所有员工工作地址,不重复
    select distinct workaddress from emp;