数据库第五次作业-查询数据

    1. 查询教师表中教师号在T5到T10之间的所有字段数据:
      select * from huang_le_xiang where no between "T10" and "T5";
    2. 查询授课表中 周数为14 的 课程号、教师号、周数、教室号 字段数据
      select * from school_teaching_huanglexiang where week=14;
    3. 查询授课表中去重后的所有教师号
      select distinct teacher_no from school_teaching_huanglexiang;
    4. 查询授课表中教室在J栋的所有字段数据,取2-3条
      select * from school_teaching_huanglexiang where class_num like "j%" limit 1,2;
    5. 查询课程表中课时数在45,30,50中的所有字段数据
      select * from course_huanglexiang where class_hours in("45","30","50");
    6. 查看教师表中工资不等于3000的 姓名、工资、岗位津贴 字段数据
      select name,prof,sal,comm from huang_le_xiang where sal!="3000";
    7. 查询教师表中岗位津贴小于1500的 姓名、职称、工资、岗位津贴 字段数据
      select * from huang_le_xiang where comm<"1500";
    8. 查询教师表中岗位津贴为空的所有字段数据,按工资从小到大排序
      select * from huang_le_xiang where comm is null order by sal asc;
    9. 查询课程表中课程号在C3到C7之间的所有字段数据,按课时数从大到小排序
      select * from course_huanglexiang where no between "C3" and "C7" order by class_hours desc;
    10. 查询授课表中教室在Y栋2楼的 课程号、教师号、教室号 字段数据,取第一条
      select course_no,teacher_no,class_num from school_teaching_huanglexiang where class_num like "Y2%" limit 1;
    11. 查询教师表中 工资为2000 的 教师号、职称、工资 字段数据
      select name,prof,sal from huang_le_xiang where sal="2000";
    12. 查询教师表中去重后的所有职称
      select distinct prof from huang_le_xiang;
    13. 查询授课表中教室号在J102,Y104,Y303,J301中的所有字段数据
      select * from school_teaching_huanglexiang where class_num in ("J102","Y104","Y303","J301");
    14. 查看课程表中课时数不等于45的 课程号、课程名、周数 字段数据,按周数从小到大排序,取前两条。
      select no,name,class_hours from course_huanglexiang where class_hours!=45 order by class_hours limit 2;
    15. 查询授课表中周数大于等于50的 课程号、教师号 字段数据
      select course_no,teacher_no from school_teaching_huanglexiang where week>=50;
    16. 查询课程表中课程名称以字母“M”开头并且课程名称中有“L”字母的所有字段数据
      select * from course_huanglexiang where name like "m%l%";

     

     

     

     

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值