标签:大于 优先级 delete 排序 div 结合 -- 实现 地址
select * from 表名 where 条件;
select * from students where id>3;
select * from subjects where id<=4;
select * from students where sname!=‘黄蓉‘;
select * from students where isdelete=0;
select * from students where id>3 and gender=0;
select * from students where id<4 or isdelete=0;
select * from students where sname like ‘黄%‘;
select * from students where sname like ‘黄_‘;
select * from students where sname like ‘黄%‘ or sname like ‘%靖%‘;
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 sum(id) from students where gender=1;
select avg(id) from students where isdelete=0 and gender=0;
select 列1,列2,聚合... from 表名 group by 列1,列2,列3...
select gender as 性别,count(*)
from students
group by gender;
select hometown as 家乡,count(*)
from students
group by hometown;
select 列1,列2,聚合... from 表名
group by 列1,列2,列3...
having 列1,...聚合...
方案一
select count(*)
from students
where gender=1;
-----------------------------------
方案二:
select gender as 性别,count(*)
from students
group by gender
having gender=1;
select * from 表名
order by 列1 asc|desc,列2 asc|desc,...
select * from students
where gender=1 and isdelete=0
order by id desc;
select * from subject
where isdelete=0
order by stitle;
select * from 表名
limit start,count
select * from students
where isdelete=0
limit (n-1)*m,m
select distinct *
from 表名
where ....
group by ... having ...
order by ...
limit star,count
标签:大于 优先级 delete 排序 div 结合 -- 实现 地址
原文地址:https://www.cnblogs.com/ghming/p/8921165.html