0
点赞
收藏
分享

微信扫一扫

机器人十大前沿技术(2023-2024年)

萨摩斯加士奇 2024-02-21 阅读 20

SQL数据库基础语法-查询语句

image-20220819202544726

image-20220819203205263

Group By #对数据进行分组

image-20220820211055942

>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();

举报

相关推荐

0 条评论