查询

Posted on 2017-10-25 20:23  仙人板板  阅读(103)  评论(0编辑  收藏  举报

查询住址为 ‘北京’,上海的学生姓名,电话,住址

SELECT studentname,phone,addres FROM student WHERE addres='北京' or‘上海’

 

查询名称中含有‘数据库’字样科目信息

SELECT * FROM subject WHERE subjectname like ‘%数据库%’

 

查询电话中以‘138’开头的学生信息

SELECT * FROM student WHERE phone like ‘138%’

 

查询姓姜的但明的学生信息

SELECT * FROM student WHERE studentname like ‘姜_’

查询某1994-07-15到1998-09-09出生日期之间学生信息

SELECT * FROM student WHERE borndate between ‘1994-07-15’ and ‘1998-09-09’

 

限定学号为2号的学生的某些科目的考试成绩信息

SELECT *FROM result WHERE resultno=2 and subjectid in(1,2,3)