CSIE4100 Software Engineering
CSIE4105 Database Systems Homework # 3
Due on 12/05/2018
-
(55%) Consider the following database schema.
STUDENT(StudentNumber, Name, Class, Major) COURSE(CourseNumber, CourseName, CreditHour, Department) SECTION(SectionNumber, CourseNumber, Semester, Year, Instructor) GRADE_REPORT(StudentNumber, SectionNumber, Grade) PREREQUISITE(CourseNumber, PrerequisiteCourseNumber) Specify the following queries in SQL.- (a) (5%) Change the credit hours of the course ‘Database Systems’ for the ‘CSIE’ department to 3.
- (b) (5%) Delete the record for the student whose name is ‘Edward’ and whose student number is ‘001’.
- (c) (5%) Retrieve the names of all courses taught by Professor ‘Chen’ in years 2017 and 2018.
- (d) (5%) For each section taught by Professor ‘Chen’, retrieve the course number, semester, year, and the number of students who took the section.
- (e) (5%) Retrieve the prerequisite course number and name for the course ‘Programming II’ offered by the ‘CSIE’ department.
- (f) (5%) Retrieve the name and transcript of each junior student (Class=3) majoring in ‘CSIE’. A transcript includes course number, course name, credit hours, semester, year, and grade for each course completed by the student.
- (g) (5%) Retrieve the names of students who have a grade greater than or equal to 80 in all of their courses.
- (h) (5%) Retrieve the names and major departments of all students who do not have a grade below 60 in any of their courses.
- (i) (5%) Retrieve the names and majors of all students who have a grade below 60 in any of their courses, order alphabetically by the student number.
- (j) (5%) Retrieve the names and their average grades for the students who have an average grade greater than 80.0 in year 2018.
- (k) (5%) For each department (i.e., student major), list the number of students whose average grade is below 60.0.
-
(45%) Choose a DBMS (e.g., SQL Server, Oracle or MySQL) to create and populate
the tables in problem 1.
- (a) (15%) Show your SQL statements and the execution results (screen snapshots) for creating the tables. The SQL statements need to specify the key and referential constraints (i.e., primary key and foreign key) for each table.
- (b) (10%) Populate the tables so that each table contains at least 5 tuples. Show your SQL insertion statements and the execution results (screen snapshots) for populating the tables.
- (c) (20%) Perform the SQL queries in problem 1 in your DBMS. Show your SQL query statements and the execution results (screen snapshots). Note that your SQL query results MUST NOT contain no tuples.