O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Relationships

Now that you know how to create database tables and manipulate data, it’stime to take a look at the principles of relational databases and see how to apply good design practices to your own databases.

Data in a relational database is split across several tables in a structured way. Relationships are the rules that determine how data in one table is related to data in another. When you join tables in SQL, you specify the relationship between the tables in the query. Refer to Lesson 11, “Joining Tables,” for more information on joins.

Consider the relationship between two tables in the sample database. The orders table is related to customers. Each record in the orders table contains a customer_id, which is a foreign key column that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required