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 6. Advanced Select: Seeing your data with new eyes

image with no caption

It’s time to add a little finesse to your toolbox. You already know how to SELECT data and use WHERE clauses. But sometimes you need more precision than SELECT and WHERE provide. In this chapter, you’ll learn about how to order and group your data, as well as how to perform math operations on your results.

Dataville Video is reorganizing

The owner of Dataville Video has a badly organized store. In his current system, movies can end up on different shelves depending on which employee is shelving them. He’s ordered new shelves, and he thinks it’s great time to finally label each of his movie categories.

image with no caption

To:

Dataville Video Staff

From:

The Boss

Subject:

New shelves mean new categories!

Hi gang,

The new shelves are in, so I want you to organize our movies. We can use the following categories:

Action & Adventure

Drama

Comedy

Family

Horror

SciFi & Fantasy

Misc

I’ll leave it to you to figure out how to make our current table work with these new categories.

Let’s do lunch,

Your boss

In the current system, true and false values are used for types of movies. This makes figuring out how to categorize difficult. For example, if a movie has both T for comedy and T for scifi, where should it be shelved?

Problems with our current table

Here’s a rundown of ...

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