SQL数据库基础语法-查询语句
Group By #对数据进行分组
>select name,count(id) from student group by name; #查询name字段人数,cont函数进行计数 >select * from users group by users; >select * from users where id=1 group by 2; >select * from users where id=1 group by 4; #二分法平判断数据表列数
Order By #对数据进行排列
>select * from users order by 1; #desc降序
**Limit ** #限制内容输出数量
>select * from emails limit 1,3; #限制为第1行开始往后3行 >select * from emails limit 0,3; #限制为第0行开始往后3行
And 和 Or #与 和 或
>select * from users where id=3 and name='zhangsan' >select * from users where id=3 or name='zhangsan'
常用函数
#group_concat >select group_concat(id,name,sex) from users; >select database(); >select version();