4.14

Consider the query

SELECT course_id,semester,year,sec_id,AVG(tot_cred)
FROM takes NATURAL JOIN student
WHERE year = 2017
GROUP BY course_id,semester,year,sec_id
HAVING COUNT(id) >= 2; 

Explain why appending NATURAL JOIN section in the FROM clause would not change the result.


Appending NATURAL JOIN section in the FROM clause would not change the result because there is no logic in the query that uses attributes in section that are not found in takes relation. Also since every tuple in takes relation has a corresponding tuple in the section relation (due to foreign key constraint), there will be no change if we append the NATURAL JOIN section in the FROM clause.