Performing Joins
Because relational databases are more complexly structured, they sometimes require special query statements to retrieve the information you need most. Joins—SQL queries performed by cross-referencing tables—are used to extract more usable data from relational databases.
There are several types of joins conceivable according to SQL, although MySQL is slightly restricted in this one area. Beginning to intermediate users will find that the two most basic joins, which I’ll teach in this chapter, will suffice for almost every application. The most used join is called an inner join.
SELECT * FROM urls, url_types WHERE urls.type_id = url_types.type_id;
The benefit of this join is that it will retrieve all of the information from ...
Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.