第一题:在表 Teachers中插入一条新的记录:600001 杨梦女 64 1966/04/22 YES 1660 210要求:日期的格式为#4/22/1966#insert into teachers values (“600001“,“ 杨梦 “,“女“,64,#4/22/1966#,YES,1660,210) 第二题 :在表 Teachers中删除年龄小于36 且性别为 “ 女” 的记录delete from teachers where 年龄 =25 第四题:查询 1990 年之前(包括1990 年)参加工作的所有教师的教师号、姓名和实发工资,查询结果按实发工资从高到低排序select 教师号 ,姓名 ,应发工资 -扣除工资as 实发工资from teachers where 参加工作年月<#1/1/1991# order by 应发工资 -扣除工资desc 第 五 题 :查 询 教 师 的 人 数 和 平 均 实 发 工 资 请 参 阅 下 图 ( 仅 供 参 考 )select count(*) as 教师人数 ,avg(应发工资 -扣除工资 ) as 平均实发工资from teachers 第六题: 查询男女职工的最低工资、最高工资和平均工资 (工资是指实发工资) 。
请参阅下图 (仅供参考)select 性别 ,min( 应发工资-扣除工资) as 最低工资 ,max(应发工资-扣除工资) as 最高工资,avg(应发工资 -扣除工资 ) as 平均工资from teachers group by 性别第七题:分组查询党员和非党员教师所教学生的人数以及平均成绩,查询结果按平均成绩从大到小排列请参阅下图(仅供参考) SELECT 党员 ,count(*) as 学生人数,avg(分数 ) as 平均成绩from teachers,students where teachers.教师号 =students.教师号group by 党员 order by avg(分数 ) desc 第八题:查询党员和非党员的人数和平均年龄请参阅下图(仅供参考)SELECT 党员 ,count(*) as 教师人数 ,avg(年龄 ) as 平均年龄from teachers group by 党员第九题:请查询每一个学生的学号、姓名,以及任教教师的教师号、姓名和性别, 查询结果按学号从大到小排序请参阅下图 (仅供参考)select 学号 ,students.姓名as 学生姓名 ,teachers.教师号 ,teachers.姓名as 教师姓名 ,teachers.性别from teachers,students where teachers. 教师号 =students.教师号order by 学号 desc 第十题:查询每一个教师的教师号、姓名以及所教学生的最低分、最高分和平均分。
请参阅下图(仅供参考) select teachers.教师号as 教师号 ,teachers.姓名as 姓名 ,min(分数 ) as 最低分 ,max(分数 ) as 最高分 ,avg(分数 ) as 平均分from teachers,students where teachers.教师号 =students.教师号group by teachers.教师号 ,teachers.姓名。