create database active
on
(name='arch1',
filename='c:\program files\microsoft sql server\mssql\data\archda1_data.mdf',
size=5,
maxsize=50,
filegrowth=1
)
log on
(name='archlog1',
filename='c:\program files\microsoft sql server\mssql\data\archlog1_log.ldf',
size=5,
maxsize=50,
filegrowth=1
)
go
(1)select cname as 课程名 ,teacher as 任课老是
from b where teacher ='刘老师';
(2) select a# as 学号,sname as 姓名 from A where sex ='女';
(3) select cname,teacher from b where b#=(select b# from ab where a#='1005')
(4) select a.sname,a.a#,b.b# from a,ab,b where b.cname='英語范讀' and b.b#=ab.b# and ab.a#=a.a# and a.sex='男'
(5)问题好像错了??
2.
(1)
select sum(期中成績)/ count(學號) as 平均分,sum(期中成績) as 總分
from 學生成績表 group by 課程號
(2)
select 學號, sum(期末成績) /count(學號) as 期末平均分,sum(期末成績) as 總分
from 學生成績表 group by 學號(3)select 課程號, sum(期末成績) /count(學號) as 期末平均分,sum(期末成績) as 總分
from 學生成績表 where (select sum(期末成績) /count(學號) from 學生成績表) >60 group by 課程號