代码改变世界

第四章数据查询入门课后实践作业

2019-09-28 14:46  小橘子子  阅读(189)  评论(0)    收藏  举报

2.查询表中字段信息
(1)SELECT * FROM stu;
(2)SELECT `name`,age  from stu;
(3)SELECT `name` from stu;
(4)SELECT `NAME`,addres from stu ;
(5)SELECT `name`,age FROM stu;
(6)SELECT SUBJECT,score FROM stuscore;
3.指定条件查询表中信息
(1)SELECT *FROM stuscore WHERE stu-id>'3';
(2)SELECT * from stu where age>23;
(3)select `name`,addres,age,id from stu where id>5;
(4)select * from stu where addres!='上海';
4.where条件中其他关键字
(1)select *FROM stu WHERE age='22' AND'24';
(2)SELECT *FROM stu where addres!='上海'AND addres!='深圳';
(3)SELECT *FROM stu where NOT(addres='北京'OR addres='上海'or addres='深圳');
(4)select *FROM stu where age BETWEEN '22' AND '26';
(5)select *from stu where birthday=1993;
(6)select *from stu where birthday is null;
(7)select *from stu where birthday IS not null;
(8)select *from stuscore where score between '60' and '80';
(9)select *from stuscore where score='70'or score='80'OR score='90';
(10)select * from stu where addres='北京'or age<'22';