当前位置:Gxlcms > 数据库问题 > Mysql表数据查询操作

Mysql表数据查询操作

时间:2021-07-01 10:21:17 帮助过:4人阅读

1、简单查询

select * from user;

2、NULL查询

select * from user where hobby is NULL and age is not NULL;

3、in查询

select * from user where age in('22','23','24');

4、between and查询

select * from user where age between 21 and 55;

5、or查询

select * from user where age=22 or age=23

6、order by 查询

select * from user order by age asc; 升序
select * from user order by age desc; 降序

7、group by查询

select name,sum(age) from user group by name

8、常见聚合函数

count(*)函数;
sum()函数;
avg()函数;
max()函数;

9、内连接查询

select u.id,f.name from user u inner join user f on u.id=f.id; 推荐
select u.id,f.name from user u,user f where u.id=f.id;

10、外连接查询

select u.id,f.name from user u left join user f on u.id=f.id;

11、

Mysql表数据查询操作

标签:group   obb   sel   avg   count   use   sele   tween   inner   

人气教程排行