明天考課數據庫實驗了,自己晚上把操作題目簡單的做了一下
2015年1月5日01:11:04記錄:
①查詢所有同學的基本信息,包括:學號s_no,班級號class_no,姓名s_name,性別s_sex,出生日期s_birthday.
select *from Student
①查詢所有選修了課程但考試不及格(假設〈60分為不及格)的所有同學及相應的課程,要求顯示學生的學號s_no,姓名s_name,課程號course_no,課程名稱course_name,課程成績course_score.
select Student.Sno,Student.Sname ,course.course_name,course.course_no,course.score
from Choice inner join
Student on Choice.Sno=Student.Sno inner join
course on Choice.courseno=course.course_no
where(choice.score<60)
③查詢“計算機系”的所有同學及成績情況,要求顯示學生的學號s_no,姓名s_name,班級姓名class_name,課程號course_name,課程成績score。
(4)查詢所有同學,要求顯示其學號s_no、姓名s_name。
select Student.Sno,Student.Sname
from Student
(5)查詢所有男同學,要求顯示其學號s_no、姓名s_name、出生日期s_birthday
select Sno,Sname,Sbirthday
from Student
where (Ssex='男')
(6)查詢所有姓“李”的男同學,要求顯示其學號s _no、姓名s _name、性別s _sex、出
生日期s _birthday。
select Sno,Sname,Ssex,Sbirthday
from Student
where (Ssex='男') AND (Sname like'李%' ) //如果是含有李(Sname like'%李%' )
查詢所有姓名中含有“一”字的同學,要求顯示其學號s_no,姓名s_name.
select Sno,Sname
from Student
where (Sname like'%一%' );
查詢所有職稱不是“講師”的教師,要求顯示其教師號t _no、姓名t _name、職稱t _title。
select tno,tname,ttitle
from teacher
where (ttitle !='講師')
查詢雖選修了課程,但未參加考試的所有同學,要求顯示出這些同學的學號s _no。
select Sno
from Choice
where score is null
查詢所有考試不及格的同學,要求顯示出這些同學的學號s _no、成績score,并按
成績降序排列。
select Sno,score
from Choice
where Choice.score <60
ORDER BY score DESC(降序)ASC(升序)
文章很好~!贊
考前自己整理
東西還不錯,支持一下!
企業網站模板 http://www.youtiy.com 交換友情鏈接
sql查詢俺就只記得一個select了 呵呵
數據庫工程師?
考的怎樣了~
還考試啊。
很適用的SQL查詢。
配圖很強悍
不是這個專業,不過也可以看看,學習一下!