June 2005
Intermediate
720 pages
20h 6m
English
Now that the database has some records in it, you can begin to retrieve the information with the most used of all SQL terms, SELECT. This type of query returns rows of records that match certain criteria, using the syntax
SELECT which_columns FROM which_table
The simplest SELECT query is
SELECT * FROM tablename
The asterisk means that you want to view every column. Your other choice would be to specify the columns to be returned, with each separated from the next by a comma.
SELECT user_id, first_name, last_name → FROM users
There are a few benefits to being explicit about which columns are selected. The first is performance: There’s no reason to fetch columns you will not be using. The second is order: You can return columns ...
Read now
Unlock full access