Skip to Content
Head First SQL
book

Head First SQL

by Lynn Beighley
August 2007
Beginner to intermediate
608 pages
13h 12m
English
O'Reilly Media, Inc.
Content preview from Head First SQL

Chapter 8. Joins and Multi-Table Operations: Can’t we all just get along?

image with no caption

Welcome to a multi-table world. It’s great to have more than one table in your database, but you’ll need to learn some new tools and techniques to work with them. With multiple tables comes confusion, so you’ll need aliases to keep your tables straight. And joins help you connect your tables, so that you can get at all the data you’ve spread out. Get ready, it’s time to take control of your database again.

Still repeating ourselves, still repeating...

Greg noticed the same values for status, profession, interests, and seeking popping up again and again.

image with no caption

Prepopulate your tables

Wouldn’t it make sense to have a set list of values in some of the tables?

Having many duplicate values will make it easy to prepopulate the status, profession, interests, and seeking tables. Greg wants to load up those four tables with the values already in his old my_contacts table.

First he needs to query his table to find out what’s already in there. But he doesn’t want an enormous list of duplicate values.

image with no caption
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Head First SQL, 2nd Edition

Head First SQL, 2nd Edition

Kimberly Fessel
Learning SQL

Learning SQL

Ben Forta
Practical SQL

Practical SQL

Anthony DeBarros

Publisher Resources

ISBN: 9780596526849Supplemental ContentErrata Page