Mysql学习(慕课学习笔记9)查询、分组
查找记录 Select
select username,id from users;
Group by 进行分组
select sex from users group by sex;
分组条件
select age,sex from users group by sex having age>21;
查询结果进行排序
Desc 降序
select * from users order by age,id desc;
限制查询结果返回的数量
select * from users limit 2,2;
返回第3、4条记录
Insert 配合select语句使用
insert test1(username) select username from users where age>-=21;