mysql

Posted shamezhi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql相关的知识,希望对你有一定的参考价值。

select * from students where id in(1,3,8);
select * from students where id between 3 and 8;
select * from students where id between 3 and 8 and gender=1;
select * from students where hometown is null;
select * from students where hometown is not null;
select * from students where hometown is not null and gender=0;

聚合函数
select count(*) from students;
select max(id) from students where gender=0;
select min(id) from students where isDelete=0;

select * from 表名 where 条件;
select * from 表名 group by 列1,列2,。。。、
select * from 表名 order by 列1 asc|desc,列2 asc|desc,...

select * from 表名 limit start,count;
select * from students where isDelete=0
limit (n-1)*m,m;

完整的 select 语句
select distinct * from 表名 where 条件
group by 列1,列2,... having 条件,条件,....聚合....
order by 列1,列2,....
limit start,count
执行顺序:
--from 表名
--where...
--group by...
--select distinct *
--having ...
--order by ...
--limit start,count

























以上是关于mysql的主要内容,如果未能解决你的问题,请参考以下文章

MySQLMySQL 一些 使用 案例

MySQL的常用操作更改root密码连接MySQLMySQL常用的命令

MySQLMysql必会语句

MySQLMysql必会语句

MySQLMysql必会语句

mysqlmysql优化