SELECT — Query data from the database
SELECT * FROM tbl; SELECT name FROM employees WHERE employee_id = 54923; SELECT 5 + 6;
SELECT command is used to query the database
and return a result. The
SELECT command is the only SQL command capable
of returning a user-generated result, be it a table query or a
simple expression. Most consider
SELECT to be the most complex SQL command.
Although the basic format is fairly easy to understand, it does
take some experience to understand its full power.
All of Chapter 5 is devoted to the
SELECT command follows a simple pattern that can be roughly
. The output section describes the data that makes up the result set, the input section describes what tables, views, subqueries, ...