O'Reilly logo

Using SQLite by Jay A. Kreibich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

SELECT — Query data from the database

Syntax

image with no caption

result-column:

image with no caption

join-source:

image with no caption

single-source:

image with no caption

ordering-term:

image with no caption

compound-operator:

image with no caption

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 output FROM input WHERE filter. The output section describes the data that makes up the result set, the input section describes what tables, views, subqueries, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required