上机1
select StudentName,Phone, Address
from Student where Address like '山东%'
select SubjectName, ClassHour, GradeId
from Subject where SubjectName like '%数据库%'
order by GradeId
select StudentName, Phone, Address
from Student where Phone like '1387%'
select StudentNo, StudentName, Address
from Student where StudentName like '姜_'
select Id, StudentNo, SubjectId, StudentResult, ExamDate
from Result where StudentNo='S1101004' and SubjectId in(1,2,3)
select StudentNo, LoginPwd, StudentName, Sex, GradeId, Phone, Address, BornDate, Email
from Student where BornDate between '1989-1-1' and '1995-12-31'
上机2
select COUNT(*) as '学生总人数'
from Student
select sum(ClassHour) as '第一学期的总学时'
from Subject where GradeId=1
select SUM(StudentResult) as 'S1101004学生第一学期的总成绩'
from Result,Subject where GradeId=1 and StudentNo='S1101004'
select AVG(StudentResult) as 'S1101004学生第一学期的平均分'
from Result,Subject where GradeId=1 and StudentNo='S1101004'
select MAX(StudentResult) as '最高分',MIN(StudentResult) as '最低分',AVG(StudentResult) as '平均分'
from Result,Subject where SubjectName='使用C#语言开发数据库应用系统' and ExamDate='2013-03-22'
select AVG(StudentResult) as '平均分'
from Result,Subject where SubjectName='使用C#语言开发数据库应用系统' and StudentResult>=60
select AVG(StudentResult) as '平均分'
from Result,Subject where SubjectName='使用C#语言开发数据库应用系统'