查找記錄 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;