In the examples in this module we will use an existing database. For example we will use data from the pubs database to display the Title column from Titles table and column PubName from Publishers table. Both these tables have a relationship at Pub_id column.
SELECT t.Title, p.Pub_Name FROM Publishers p INNER JOIN Titles tIf you use multiple joins to connect more than two tables, it's easier if you think about each joint separately. For example you have three tables: A, B and C will be connected. First join will linking A and B, and then the results will be combined with C with the second join to produce the final data. Query optimizer will make a plan of execution, although the result is same. From a number of plans selected the most optimal execution.
ON p.Pub_id = t.Pub_id ORDER BY Title ASC