Q1. Suppose in an SQL query I have natural join as : from R1 natural join R2 natural join R3 natural join R4
then how does the natural join works? According to me, First R1 joins with R2 matching common attributes value between R1 and R2 then the result of R1, R2 joins with R3 matching common attributes between R1R2 and R3 and so on. Am I correct?
Q2. if no attribute matches in natural join: from R1 natural join R2
will the result be an empty relation?
Q3. page No. 73 Of Korth Book
Relation schemas of three relations are as follows
course(course_id, title, dept_name, credits)
instructor(ID, name, dept_name, salary)
teaches(ID, course_id, sec_id, semester, year)
Query is “List the names of instructors along with the the titles of courses that they teach.”
So the SQL query used is: select name, title
from instructor natural join teaches, course
where teaches.course_id= course.course_id;
But at the bottom of the page, it is given
" it is not possible to use attribute names containing the original relation names, for instance, instructor.name or teaches.course_id, to refer to attributes in the natural join result; we can, however, use attribute names such as name and course_id, without the relation names "
but teaches.course_id is used in the query. WHY? It's not allowed.