how to join three tables in sql primary key and foreign key in mysql to access data code example

Example 1: join multiple tables in sql

SELECT Books_Namn, Author_Namn, Author_Age, Store_Namn FROM books

JOIN Author ON Author_Id = Author_Author_Id

JOIN Books_has_Store ON Books_Books_Id = Books_Id

JOIN Store ON Store_Id = Store_Store_Id;

Example 2: sql join 3 tables

SELECT column-names
  FROM table-name1 JOIN table-name2 
    ON column-name1 = column-name2
 WHERE condition

Tags:

Sql Example