Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL Homework 1 The schema of the database is provided below (keys are in bold, f

ID: 3704230 • Letter: S

Question

SQL Homework 1 The schema of the database is provided below (keys are in bold, field types are omitted): . student (sid, studentName, gpa) * dept (deptName, numPhDs) prof (profName, deptName) .course (cno, courseName, deptName . major (deptName, sid) . section (deptName, cno, sectno, profName) * enroll (sid, grade, deptName, no, sectno) 10. Retrieve the ids, names, and GPAs of the students who are currently taking all of the Civil Engineering courses Query # 1 0 exposes a data inconsistency. For this question, describe the inconsistency and how you would change the design of the tables to eliminate the problem

Explanation / Answer

Solution:

10)

Query:

SELECT sid, studentName, gpa FROM student INNER JOIN enroll ON student.sid= enroll.sid INNER JOIN course ON enroll.cno= course.cno WHERE deptName= 'Civil Engineering'

If the enroll table is decomposed into two relations then we can remove the inconsistency.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)