Selecting Data

The SELECT statement is the command you use to extract information from your database. The simplest way to use it is to ask for a single string:

sqlite> SELECT 'Hello, world!';Hello, world!

You can also run expressions:

sqlite> SELECT 1 + 1;2

It would be far more interesting to get information out of a table. This requires the FROM keyword to indicate the name of the table. The FROM clause happens after the SELECT clause.

sqlite> SELECT * FROM book;id          title                                year        author_id----------  -----------------------------------  ----------  ----------1           LPIC 1 Exam Cram 2                   2004        22           Linux and ...

Get CompTIA® Linux+ / LPIC-1 Cert Guide: (Exams LX0-103 & LX0-104/101-400 & 102-400) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.