Changes

Jump to: navigation, search

Joining Tables in MySQL

No change in size, 18:06, 1 February 2016
m
Text replacement - "<google>ADSDAQBOX_FLOW</google>" to "<htmlet>adsdaqbox_flow</htmlet>"
== How Does a Join Work? ==
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
A join works through the use of keys. Continuing our example, our ''supplier'' table contains a column designated as the ''supplier_id''. This column is configured as the primary key (for details on primary keys see [[Database Basics]]). The ''product'' table contains all of the products sold by our company, including product id, product description and product name. In addition it also contains the supplier id of the supplier from which we buy the individual products. Because this is a key from a different table (the ''suppliers'' table) it is referred to as a ''foreign key''. When using a ''SELECT'' statement to retrieve data from the product table we can use this foreign key to extract the relevant supplier information from the supplier table for each product.

Navigation menu