Mysql表数据查询操作
Posted Andy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql表数据查询操作相关的知识,希望对你有一定的参考价值。
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表数据查询操作的主要内容,如果未能解决你的问题,请参考以下文章