Previous Topic: ReviewNext Topic: Retrieving all Columns from a Table


Retrieving Data

Goal

After completing this chapter, you will be able to respond to requests for information from Commonwealth Auto by creating SQL statements that:

Summary

To retrieve data from the database, you use the SELECT statement, probably the most frequently used SQL statement.

Online Exercises

The online exercises for this self-training guide begin in this chapter.

Important! Before you begin, be sure to read Online Exercises in the chapter "Introduction" in the preface of this guide.

When you see a complete statement ending with a delimiter (;) and the label How it's done, you can enter the statement online. The result you obtain should have the same content as the one in the book.

In most cases, after you have entered a statement, you will see another suggested retrieval with the label Now you try it. This time, you will use the knowledge you just gained to create your own statement online.

If your result does not match the one shown in the guide, or if you are unable to compose a statement, you can look up the correct syntax in Appendix B,"Answers to Exercises."

At the end of this chapter, there are additional scenarios and review exercises to give you extra practice with SQL.

The Database You'll Use

You will use the Commonwealth Auto database for these online exercises. The tables in this database contain data about employees, jobs, skills, projects, and departments.

Before you begin the online exercises in this chapter, look in Appendix C,“Table Descriptions” at the type of information kept in each table.

This section contains the following topics:

Retrieving all Columns from a Table

Retrieving Selected Columns from a Table

Renaming Column Headings

Displaying Calculations in Columns

Eliminating Duplicate Rows

Organizing Data

Review

Scenarios