Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to join three tables in SQL?

1 Answer

0 votes
by (119k points)
edited by

Suppose you have three tables Students, Marks, and Details tables that look like this:

Students Table

Marks Table

Details table

We join Students table and Marks table on s_id columns of both tables and join the result-table with where school_id of Details table and school_id of Marks table matches. Here is the query to join these Students, Marks, and Details tables.

SELECT s_name, score, status, address_city, email_id

FROM Student S

INNER JOIN Marks M

ON S.s_id = M.s_id

INNER JOIN Details D on

D.school_id = M.school_id;

You can take up the best SQL courses by Intellipaat to learn writing complex SQL queries.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Apr 20, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...