InterviewSolution
Saved Bookmarks
| 1. |
Write an SQL query to join three tables. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Answer» At times, you might need to retrieve data from three or more tables at once. A multi-table join requires consecutive JOIN operations: the first and second tables are joined to form a virtual table and then the third table is joined to this virtual table. Let's take a look at three tables. Here’s the Employee table.
Here's the Employment table.
Here’s the EmpDetail.
FROM Employee e INNER JOIN Employment m ON e.Emp_ID = m.EMP_ID INNER JOIN EmpDetail d on d.Emp_Email = m.Emp_Email; Output:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||