Question: SQL Databases Consider the following relational schema: course(courseID, deptName) //CourseID is the key enroll(studentID,courseID) // is the key Suppose there are three types of queries

SQL Databases

Consider the following relational schema:

course(courseID, deptName) //CourseID is the key enroll(studentID,courseID) // is the key Suppose there are three types of queries commonly asked on this schema:

(1) Given a courseID, find the name of the department offering that course. (2) Find all students together with all of the departments they are taking courses in; i.e., effectively take the natural join of enroll and course. (3) Given a studentID, find all courses the student is enrolled in.

Questions:

(a) What is the minimal number of indexes needed to speed up all three types of queries?

(b) On which attributes should these indexes be created?

(c) Recommend what type of index to use in each case.

Helpful tip: Before answering, write down the queries for (1), (2), and (3).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!