一、create table grade(class int(20),chinese int(20),english int(20),math int(20),name varchar(20),age int(20),sid int(20) primary key); 二、insert into grade(class,chinese,english,math,name,age,sid)values(1833,86,90,40,"zhangsan",21,1),(1832,55,86,66,"lisi",22,2),(1833,93,57,98,"zhaoliu",23,3),(1832,84,90,88,"wangwu",24,4),(1833,93,57,22,"lijiu",25,5),(1832,84,98,77,"niuqi",26,6),(1832,56,57,77,"liuli",27,7),(1833,48,58,88,"wangbo",28,8),(1832,78,57,88,"wangsan",29,9),(1833,87,60,65,"wanggan",30,10),(1832,80,76,88,"wangping",31,11),(1833,null,79,88,"wanghui",32,12); 1.select * from grade where class=1832; 2.select * from grade where class=1833 and chinese between 80 and 90; 3.select * from grade where sid limit 4,6; 4.select name,sid from grade where class=1832 and english=98 and math=77; 5.select * from grade where class=1832 order by chinese desc; 6.select name from grade where class in(1833,1832) and chinese<80 and math<80; 7.select name,class from grade where chinese is null; 8.select name from grade where chinese<60 or chinese is null; 9.select class,avg(math) from grade group by class; 10.select class,sum(chinese) from grade group by class; 11.update grade set chinese=60 where chinese<60 or chinese is null; 12.select name,class from grade where chinese>70 and english>70 and math>70; 13.select name,class from grade where english>70 and (chinese>60 or math>60); 14.select class,count(*) from grade group by class; 15.select class,count(*) from grade where math>80 group by class; 16. 17. alter table grade add(history int(20),biology int(20),geography int(20)); file:///C:\Users\86176\AppData\Local\Temp\ksohtml\wps24.tmp.jpg file:///C:\Users\86176\AppData\Local\Temp\ksohtml\wps25.tmp.jpg
|