朋友们,帮我一下做下sql题目

来源:百度知道 编辑:UC知道 时间:2024/06/28 06:31:04
1.修改学生表student(num,name,sex,birth,class)中的学号字段(num,文本类型)数据中的第三个数字开始的两位修改为‘11’、其他的数据不变。

2.在学生表student(num,name,sex,birth,class)中,写出查询出学生共有多少个班(可以用多种方法)的语句。

3.对学生表student(num,name,sex,birth,class)中的数据按birth中的年份相同的值进行分组,求每个组中的人数,并显示出来。

4.将教师表teacher(tno,tname,tsex,salary,dept)和学生表student(num,name,sex,birth,class)的教师编号tno、姓名tname、部门dept和学生表中的学号num、姓名name、班级class的数据提取出来生成一个新表,表的名称为data,表的结构为(num,name,unit)。

5.通过学生表student(num,name,sex,birth,class),对成绩表scoretable(num,eng,math,che)中除了“计科一班”的学生以外,全部学生的英语成绩加上10分。

6.通过教师表teacher(TNo,TName,TSex,TSal,TPost,TDep)中的编号,删除课程表course(CNo,CName,TNo)中某一教师所上的课程。

7.在学生表中查询所有比“尹代良”成绩高的学生姓名、性别、班级和尹代良的成绩。
select a.tname,a.tsal,a.tsex from Tteacher a,Tteacher b where a.tsal>b.tsal and b.tname='刘伟夫'

8.查询陈卫老师讲授的课程,要求显示出教师号、姓名、课程号
select a.tname,b.cno from Tteacher a , Tcourse b where a.tno=b.tno and a.tname='陈卫'

1:update student set substring(num,3,2)='11'
2:select count(*) from (select distinct class from student)
3:select num,name,sex,class,Gp,-- 组
max(row_num over(partition Gp order by num)) StudNum -学生数
from
(select num,name,sex,year(birth) Gp,class from student)M
group by Gp
4:create table data(num int,name varchar(50),unit char(10))
insert into data
select * from
(select tno,name,dept from teacher
union all
select num,name,class from student)
5:update scoretable set eng=eng+10
where (select class from student where num=scoretable .num)<>'计科一班'
6:delete from course
where (select TName from teacher where TNo=course.Tno)='教师名'
7:select Sname,Sex,class from student
where eng>(select eng from scoretable a where (select num from student where a.num=num)='尹代良') or che>(select che from scoretable a where (select num from student where a.