1 / 20

SQL (Structured Query Language)

SQL (Structured Query Language). SQL Query (前提). 假设存在以下三张表. Student. Course. SC. SQL Query. 单表查询 多表查询 案例. 单表查询 — 查询指定列. 查询全体学生的学号,姓名 查询全体学生的姓名和出生年份. 单表查询 所有列. 单表查询 列别名. 查询选修了课程的学生编号. Select Sno from SC; 如何去掉重复结果?. 查询选修了课程的学生编号. Select distinct Sno from SC;. Where 条件过滤.

Download Presentation

SQL (Structured Query Language)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQL (Structured Query Language)

  2. SQL Query (前提) 假设存在以下三张表

  3. Student

  4. Course

  5. SC

  6. SQL Query • 单表查询 • 多表查询 • 案例

  7. 单表查询—查询指定列 • 查询全体学生的学号,姓名 • 查询全体学生的姓名和出生年份

  8. 单表查询 所有列

  9. 单表查询列别名

  10. 查询选修了课程的学生编号 Select Sno from SC; 如何去掉重复结果?

  11. 查询选修了课程的学生编号 Select distinct Sno from SC;

  12. Where 条件过滤

  13. Where 查询计算机系(CS)所有学生

  14. Where • 查询年龄20岁以下的学生

  15. Where • 查询有成绩不及格的学生 • 查询所有成绩不及格的学生???

  16. Where • 查询年龄在20~23之间的学生编号,学生姓名

  17. Where • 查询信息系(IS),数学系(MA),计算机科学系(CS)学生的学生编号和性别

  18. Where 模糊查询 like

  19. Where 模糊查询 like • 如果查询条件中没有包含通配符,like可以用= 代替

  20. Where Like Escape

More Related