Name
SELECT — Query data from the database
Syntax
result-column:
join-source:
single-source:
ordering-term:
compound-operator:
Common Usage
SELECT * FROM tbl; SELECT name FROM employees WHERE employee_id = 54923; SELECT 5 + 6;
Description
The 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.
Basic format
The core SELECT
command follows a simple pattern that can be roughly
described as SELECT
. The output section describes the data that makes up the result set, the input section describes what tables, views, subqueries, ...output
FROM
input
WHERE
filter
Get Using SQLite 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.