根据SQL标准,要查询表student中所有年龄age小于所有学生的平均年龄的记录,下面哪条语句适用?()
A select * from student where age< avg(age)
B select * from student having age< avg(age)
C select * from student a where a.age< (select avg(b.age) from student b)
D select * from student a where (select avg(b.age) from student b ) >= a.age
第1题:
根据SQL标准,增加一条记录到表student,学号sno是11301,姓名sname是“snoopy”,年龄age是20。其中student表中包括学号、姓名、年龄、籍贯、系别等属性,并且属性除sno外皆可取空值。下面哪条是参考的?()
A insert into student values(sno=11301, sname=’snoopy’, age =20)
B insert into student(sno,sname,age) values(11301,’snoopy’,20)
C insert into student set sno=11301, sname=’snoopy’, age = 20
D insert into student values (11301, ’snoopy’, 20)
第2题:
根据SQL标准,要删除表student中所有数据,但不将表student的定义一起删除,下面哪个语句可以适用?()
A delete from student
B delete all from student
C delete * from student
D drop table student
第3题:
根据SQL标准,查询表student(sno,sname,sex,dept)中所有学生的选修课程数,其中选修记录在表SC(sno,cno,grade)中,两表中sno为关联字段。下面哪条语句合适?()
A select sno,count(cno) from SC
B select sno,count(cno) from student
C select a.sno,count(cno) from student a left outer join SC
D select a.sno,count(cno) from SC left outer join student a
第4题:
根据SQL标准,下面哪句语句能够找出年龄最小的同学?其中age为学生表student中的年龄字段,sno为学生的学号。()
A select max(age) from student
B select sno from student where age = max(age)
C select sno from student having age = max(age)
D select sno from student a where a.age<= (select min(b.age) from student b)
第5题:
根据SQL标准,下面哪条语句与select min(age) from student等效?()
A select age from student where age >= min(age)
B select distinct age from student where age >= all min(age)
C select distinct a.age from student a where a.age<= any (select distinctb.age from student b)
D select distinct a.age from student a where a.age<= all (select distinct b.age from student b)