This chapter uses the university database. Its schema:
text
department(dept_name, building, budget)
instructor(id, name, dept_name, salary)
student(id, name, dept_name, tot_cred)
course(course_id, title, dept_name, credits)
prereq(course_id, prereq_id)
teaches(id, course_id, semester, year)
takes(id, course_id, semester, year, grade)
advisor(s_id, i_id)In teaches and takes, id is an instructor id and a student id. In advisor, s_id is a student and i_id is an instructor.
- Write the SQL for the expression
department. - How many tuples does the expression
coursereturn? - How many attributes does the schema of
takeshave? - In
π title (σ credits = 4 (course)), which operator works first? Give its name.