非常好的练习资料:https://groverzhu.github.io/2019/01/21/数据库关系代数练习/#more

SQL versus relational algebra

  1. Most of the databases nowadays are relational databases.

  2. To make data available to users, the most important issue in databases is how users specify

    requests for retrieving data.

  3. The SQL language is the most widely used query language today.

  4. The relational algebra forms the basis for SQL and is the internal form used for query

    processing and optimization.

Schema Diagram for University Database

CityU_Data Engineering_Relational algebra 数据库关系代数 Tutorial 1

Basic use of SQL (that you should have learnt)

A few examples of using SQL to retrieve data from the university database at the back.

1.Find the names of all instructors.

select name from instructor

2.Find the instructor names and the ID of courses they taught for all instructors who have taught some courses.

 

3.Find the instructor names and the courses they taught for all instructors in the Computer Science department who have taught some courses.

 

4.Find all courses taught in Semester A 2015 but not in Semester B 2014.

 

5.Find the average salary of instructors in the Computer Science department.

 

6.Find the average salary of instructors in each department.

 

7.Display a list of all students, with their ID, name, dept_name and tot_cred, along with the courses that they have taken.

 

相关文章: