Question: Consider a database consisting of the following five tables. Attributes that are underlined have been designated the primary key of their respective tables, and fields

Consider a database consisting of the following five tables. Attributes that are underlined have been designated the primary key of their respective tables, and fields with identical names in different tables can be safely assumed to be foreign keys. The Project Name and Course Name fields are specified as UNIQUE, and all fields are required except for Major, which may be NULL (undeclared). Students(SID, Name, Major) Projects(PID, P_Name) Courses(CID, C_Name) Members(PID, SID) Enrollments(CID, SID) Write each of the following queries in a separate file named University Query[N].Sql, where [N) is the number of the query as enumerated. Each query is worth 10 points. Fields must be selected in the order they are given at the beginning of each problem statement and results must be sorted as specified at the end of each problem statement. We have not provided you with any sample data for this part of the assignment, so it is suggested that you devise a way to test your scripts to ensure that they are correct. In all instances, do not have duplicate rows in your results. 1. Write a query that returns CID of CS-heavy courses, which is defined as the following: strictly fewer than 10 non-CS majors are enrolled (including courses in which 0 non-CS majors are enrolled). A student whose major is CS will have the VARCHAR2 value CS' for their Major field, while a non-CS student will have something else. Remember that the Major field can be NULL. The results should be sorted in descending order by CID. 2. Write a query that finds the SIDs and Names of all students with at least one project partner who is enrolled in (EECS 482 or EECS 483) and (EECS 484 or EECS 485) and (EECS 280). All students who are Members of the same Project are considered project partners. Note that each course's name is stored in the C_Name field with no space between the department abbreviation and the course number (e.g. EECS 484 is stored as 'EECS484'.) The results should be sorted in descending order by the students' names. Consider a database consisting of the following five tables. Attributes that are underlined have been designated the primary key of their respective tables, and fields with identical names in different tables can be safely assumed to be foreign keys. The Project Name and Course Name fields are specified as UNIQUE, and all fields are required except for Major, which may be NULL (undeclared). Students(SID, Name, Major) Projects(PID, P_Name) Courses(CID, C_Name) Members(PID, SID) Enrollments(CID, SID) Write each of the following queries in a separate file named University Query[N].Sql, where [N) is the number of the query as enumerated. Each query is worth 10 points. Fields must be selected in the order they are given at the beginning of each problem statement and results must be sorted as specified at the end of each problem statement. We have not provided you with any sample data for this part of the assignment, so it is suggested that you devise a way to test your scripts to ensure that they are correct. In all instances, do not have duplicate rows in your results. 1. Write a query that returns CID of CS-heavy courses, which is defined as the following: strictly fewer than 10 non-CS majors are enrolled (including courses in which 0 non-CS majors are enrolled). A student whose major is CS will have the VARCHAR2 value CS' for their Major field, while a non-CS student will have something else. Remember that the Major field can be NULL. The results should be sorted in descending order by CID. 2. Write a query that finds the SIDs and Names of all students with at least one project partner who is enrolled in (EECS 482 or EECS 483) and (EECS 484 or EECS 485) and (EECS 280). All students who are Members of the same Project are considered project partners. Note that each course's name is stored in the C_Name field with no space between the department abbreviation and the course number (e.g. EECS 484 is stored as 'EECS484'.) The results should be sorted in descending order by the students' names
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
