Working with Multiple Tables

All the commands so far have operated on a single table. A database has many tables because of a concept called normalization.

Consider the books we’ve been looking at so far. A book has a title, author, and a few other elements. But an author may write more than one book, and a book may have more than one author. (We conveniently ignore the book with multiple authors scenario.)

If the row containing the book also contains the author information, we have duplicated data:

Image

This is inefficient especially when you have to track other items about the book and author. If the author changes his address, you need to update ...

Get CompTIA® Linux+ / LPIC-1 Cert Guide: (Exams LX0-103 & LX0-104/101-400 & 102-400) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.