目录
上篇在这里喔~
增删改查1
1.条件查询WHERE
1.查询语文成绩大于60的同学
2.查询语文成绩等于NULL的同学
3.查询语文成绩在60-90之间的同学
4.查询英语成绩等于30,77,90的所有同学
5.查询小锦鲤的语文成绩是否为空
6.查询姓孙的同学的所有信息
7. 查询姓孙的同学且名字为两个字的所有信息
8.逻辑运算符
9.查询语文成绩好于英语成绩的同学
10.查询总分在两百以上的同学
11.孙同学的总分
12.语文成绩大于80,且英语成绩大于80的同学
13.语文成绩大于80,或英语成绩大于80的同学
14.查询语文成绩在【80,99】的同学
15.分页查询LIMIT
1.从0开始,选n条
2.从s开始,选n条
3.从s开始,选n条,比2更准确建议使用
2.修改操作UPDATE
1.将孙悟空的数学成绩修改为60分
2.将总成绩正数前三的3位同学的语文成绩加上2分
3.删除DELETE(危险操作)
上篇在这里喔~

增删改查1
1.条件查询WHERE

1.查询语文成绩大于60的同学
 select id, name,chinese from exam_result where chinese >= 60;
 

2.查询语文成绩等于NULL的同学
 select id, name, chinese from exam_result where chinese = null;
  select id, name, chinese from exam_result where chinese <=> null; 
一查不出来二可以

 
3.查询语文成绩在60-90之间的同学
	select id, name, chinese from exam_result where chinese between 60 and 90;
 
 
4.查询英语成绩等于30,77,90的所有同学
	select id, name, english from exam_result where english in(30,77,90);
 

5.查询小锦鲤的语文成绩是否为空
	select id, name, chinese from exam_result where name = '小锦鲤' and chinese is null;
 

6.查询姓孙的同学的所有信息
	select * from exam_result where name like '孙%';
 

7. 查询姓孙的同学且名字为两个字的所有信息
		select * from exam_result where name like '孙_';
 

8.逻辑运算符

9.查询语文成绩好于英语成绩的同学
	select id, name, chinese, english from exam_result where chinese > english;
 
 
10.查询总分在两百以上的同学
	select id, name,chinese + math+english as sum from exam_result where chinese + math+english > 200;
 

11.孙同学的总分
	select id,name,chinese + math+english as sum from exam_result where name like '孙%';
 

12.语文成绩大于80,且英语成绩大于80的同学
select id,name,chinese,english from exam_result where chinese > 80 and english > 80; 

13.语文成绩大于80,或英语成绩大于80的同学
select id,name,chinese,english from exam_result where chinese > 80 or english > 80; 

14.查询语文成绩在【80,99】的同学
select id,name,chinese from exam_result where chinese between 80 and 99; 

15.分页查询LIMIT
1.从0开始,选n条
select * from exam_result limit 6; 

2.从s开始,选n条
select * from exam_result limit 2,6; 

3.从s开始,选n条,比2更准确建议使用
select * from exam_result limit 6 offset 3; 

2.修改操作UPDATE
1.将孙悟空的数学成绩修改为60分
update exam_result set math = 60 where name = '孙悟空';
 
delete from exam_result where name = '孙悟空'; 

2.将总成绩正数前三的3位同学的语文成绩加上2分
update exam_result set chinese = chinese + 2 order by (chinese + math + english) desc limit 3;
 

3.删除DELETE(危险操作)
delete from exam_result where name = '孙悟空'; 




















