Chapter 2. The SELECT Statement: Gifted data retrieval

image with no caption

Is it really better to give than retrieve? When it comes to databases, chances are you’ll need to retrieve your data as often than you’ll need to insert it. That’s where this chapter comes in: you’ll meet the powerful SELECT statement and learn how to gain access to that important information you’ve been putting in your tables. You’ll even learn how to use WHERE, AND, and OR to selectively get to your data and even avoid displaying the data that you don’t need.

Date or no date?

Greg’s finished adding all the sticky notes into his my_contacts table. Now he’s ready to relax. He’s got two tickets to a concert, and he wants to ask one of his contacts, a girl from San Francisco, out on a date.

He needs to find her email address, so he uses the SELECT statement from Chapter 1 to view his table.

SELECT * from my_contacts;
image with no caption
image with no caption

Get Head First SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.