单表查询,多表查询
单表查询 表的基本查询语句 from where group by having distinct order by limit select * from emp\G; 当表字段特别多的时候 结果的排版可能会出现混乱的现象 你可以在查询语句加\G来规范查询结果 单表查询的前期准备 create table emp( id int not null unique auto_increment, name varchar(20) not null, sex enum('male','female') not null default 'male', #大部分是男的 age int(3) unsigned not null default 28, hire_date date not null, post varchar(50), post_comment varchar(100), salary double(15,2), office int, #一个部门一个屋子 depart_id int ); 创建表 # 三个部门:教学,销售,运营 insert into emp(name,sex,age,hire_date,post,salary,office,depart_id) values (