更新时间: 试题数量: 购买人数: 提供作者:

有效期: 个月

章节介绍: 共有个章节

收藏
搜索
题库预览
(填空题, 23分)
假设有一个学校教务管理的数据库,它包含一个学生表:
学生表:Student(Stu_id,Stu_name,Stu_sex,Birthday,Age, Phone)
表中各字段的含义及约束如下:
Stu_id为学号,字符类型,非空,主键;
Stu_name为姓名,字符类型,非空,唯一;
Stu_sex为性别,整数类型,取值0/1,非空;
Birthday为生日,Date类型;
Age为年龄,整数类型,介于12~40之间(包含12和40);
Phone为手机号码,字符类型。
现需完成以下SQL语句,以便实现相应的查询:
(1) 查询所有手机号以'13'开始,以'9'结束的学生。
Select * from Student where Phone like ________
(2) 查询所有手机号顺数第2位为1,倒数第2位为3的学生。
Select * from Student where Phone like _________
(3) 查询生日为空的所有学生。
Select * from Student where Birthday ______ NULL
(4) 查询所有学生的姓名、出生日期、手机号,并按出生日期从大到小排列。
Select _____, Birthday, Phone from Student ______ Birthday ______
(5) 统计所有学生的平均年龄。
Select _____ from Student
(6)统计所有学生的平均年龄、最大年龄、最小年龄,并分别命名为"平均年龄"、"最大年龄"、"最小年龄"。
Select avg(Age) as _____, ______ as 最大年龄, min(Age) ___ 最小年龄 from Student
(7)统计各个年龄的学生人数。
Select _____ from Student ________ Age
(8)统计年龄在20岁以下(不含20岁)的学生中,各种年龄的学生人数。
Select count(*) from Student group by Age _____ Age < 20
1