第1题
A、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S2.Score > S1.Score;
B、Select * From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S1.Score > S2.Score;
C、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S1.Score > S2.Score;
D、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002 ;
第2题
A、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S1.Score > S2.Score;
B、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S2.Score > S1.Score;
C、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002 ;
D、Select * From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S1.Score > S2.Score;
第3题
A、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S1.Score > S2.Score;
B、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S2.Score > S1.Score;
C、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002 ;
D、Select * From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002’ and S1.Score > S2.Score;
第4题
A、Select S1.S# From SC S1, SC S2 Where S1.S# = S2.S# and S1.C#=‘001’ and S2.C#=‘002 ;
B、Select S# From SC Where C# = ‘001’ AND C#=‘002’;
C、Select S2.S# From SC S1, SC S2 Where S1.S# = S2.S# or S1.C#=‘001’ and S2.C#=‘002 ;
D、Select S1.S# From SC S1 Where S1. C# = ‘001’ AND S1.C#=‘002’;
第5题
SC
SNO CNO GRADE
001 c1 90
001 c2 65
002 c1 80
002 c2 90
002 c3 86
执行SQL语句“SELECT DISTINCT cno FROM sc”的结果中的元组数是
A.2
B.3
C.4
D.5
第6题
作业五 选课系统中有5张表,描述如下: Student(Sno char(8),Sname char(10),Ssex char(2),Sage int, Dno char(8), Sclass char(6)),其中Sno为主码,Sname取唯一值,Dno是外码,被参照表是Department; Department(Dno char(2),Dname char(40),Dean char(10)) ,其中Dno为主码,Dname取唯一值; Course(Cno char(8),Cname char(20),Chours int, Ccredit float(1),Tno char(8)) 其中Cno为主码,Cname取唯一值,Tno是外码,被参照表是Teacher; Teacher(Tno char(8),Tname char(8),Dno char(8),Ssalary float(2)) 其中Tno为主码,Tname取唯一值; SC(Sno char(8),Cno char(8),Sscore float(1)) 其中(Sno,Cno)为主码;Sno是外码,被参照表是Student;Cno是外码,被参照表是Course 用SQL语言实现下列查询要求: 1. 请在Teacher表中为03系新来的李小虎老师增加一条记录,工号为006,工资为6950 2. 将SC表中成绩在90分以上的同学信息插入到新建表SCT(Sno,Cno,Sscore)中 3. 将所有计算机系的教师工资上调10% 4. 当某同学001号课的成绩低于该课程平均成绩时,将该同学该门课成绩提高5% 5. 删除有四门不及格课程的所有同学 6. 定义一个视图CompStu为计算机系的学生,通过该视图可以将Student表中其他系的学生屏蔽掉 7. 定义一个视图Teach为教师任课的情况,把Teacher表中的个人隐私方面的信息,如工资等屏蔽掉,仅反映其教哪门课及其学分等。 8. 定义视图StudStat, 描述学生的学号、姓名、平均成绩、最高成绩,最低成绩等, 9. 基于视图StudStat检索张三同学平均成绩 10. 定义视图CStu, 描述学生的学号、姓名、班级,并从该视图插入一条张三同学的信息,学号是CS001,班级是201701
第7题
第8题
A.不能
B.必须
C.自动地
D.也可以
第9题
CREATE TRIGGER tri1 ON SC AFTER INSERT,
当执行语句:INSERT INTO SC VALUES('s001', 'c01',90)
会引发该触发器执行。关于触发器执行时表中数据的说法,正确的是( )。
A.SC表和INSERTED表中均包含新插入的数据
B.SC表和INSERTED表中均不包含新插入的数据
C.SC表中包含新插入的数据, INSERTED表中不包含新插入的数据
D.SC表中不包含新插入的数据, INSERTED表中包含新插入的数据
第10题
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include <stdio.h>
define N 16
typedef struct
{ char num[10];
int s;
}STREC;
int fun(STREC *a,STREC *b)
{
}
main ()
{
STREC s [N] = { { "GA005", 85 }, { "GA003", 76 },
{ "GA002", 69 }, { "GA004", 85 }, { "GA001", 91 },
{"GA007", 72}, {"GA008", 64}, {"GA006", 87},
{ "GA015", 85), ( "GA013", 91 }, { "GA012", 64 },
{ "GA014", 91 ), { "GA011", 66}, { "GA017", 64 },
{"GA018", 64 }, {"GA016", 72 } };
STREC h[N];
int i, n;
FILE *out;
n=fun(s,h);
printf("The %d highest score :\n",n);
for (i=0; i<n; i++)
printf("%s %4d\n ",h[i].num, h[i].s);
/*输出最高分学生的学号和成绩* /
printf("\n");
ut=fopen("out45.dat", "w");
fprintf(out, "%d\n",n);
for(i=0; i<n; i++)
fprintf(out, "%4d\n ",h[i].s);
fclose(out);
}
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!