create proc p1(@cno char(8)) as select cno, AVG(grade)平均分数 from sc where cno=@cno group by cno
exec p1 @cno='c02'
create proc p2(@cno char(10),@cname varchar(20),@credit smallint) as insert into course (cno,cname,credit) values (@cno,@cname,@credit)
exec p2 @cno='c24', @credit=99, @cname='蒋正阳' exec p2 'c23', '蒋正阳', 8 select * from course where cname='蒋正阳'
create table sc2( sno char(10), cno char(10), grade smallint check(grade between 0 and 100) default 0, primary key(sno,cno) )
drop table sc2
update student set sage=sage+1 where ssex='f' update student set sage=sage-1 where ssex='f' select * from student where ssex='f'
insert into sc (sno,cno) values ('00110','c03')
update course set credit=3 where cno='c08'
select * from student where ssex='m' and sage between 21 and 24 delete student where ssex='m' and sage between 21 and 24
select * from student where sname='王%'
select top 3 * from student order by sage
select sno,cno,grade from sc where cno='c03' order by grade
select student.sno,sname,grade from student, sc where student.sno=sc.sno and sdept='cs' and ssex='f' and cno='c05' select sc.sno,sage,cname,grade from student,sc,course where student.sno=sc.sno and sc.cno=course.cno and cname='毛泽东思想'
select * from student,sc where student.sno=sc.sno and cno in ('c03','c05') and grade > 70
select sno from sc group by sno having count(*)>2
select avg(grade),max(grade),min(grade) from sc group by sno
select * from student where sage >= (select sage from student where sname='刘珊珊')
select count(cno) from student left join sc on student.sno=sc.sno where cno is not null
select * from student left join sc on student.sno=sc.sno where cno is null