Normally join specification joins only two tables. We can use FROM clauses can contain multiple join specifications.
The tblbookauthor table is a good example of a situation in which joining more than two tables is needed. This SQL query finds the titles of all books title and the names of their authors:
SELECT tb.book_id, tb.book_title, tb.Book_type, ta.Aut_Name FROM `tblbook` tb inner join `tblbookauthor` tba on tb.book_id = tba.book_id join `tblauthor` ta on tba.Aut_ID = ta.Aut_ID;
The middle table of the join `tblbookauthor` can be called the intermediate table, because tblbookauthor is an intermediate point of connection between the other tables involved in the join.
The tblbookauthor table is a good example of a situation in which joining more than two tables is needed. This SQL query finds the titles of all books title and the names of their authors:
SELECT tb.book_id, tb.book_title, tb.Book_type, ta.Aut_Name FROM `tblbook` tb inner join `tblbookauthor` tba on tb.book_id = tba.book_id join `tblauthor` ta on tba.Aut_ID = ta.Aut_ID;
The middle table of the join `tblbookauthor` can be called the intermediate table, because tblbookauthor is an intermediate point of connection between the other tables involved in the join.
No comments:
Post a Comment