Now that we have data in the database, we need to have a way to get that data back out. In SQL, this is done by using the
SELECT statement. It's a very versatile command, so there's no way that it can be covered completely in a single chapter. Instead, we'll go over some simple commands, and you can explore the commands more on your own.
The snippets in this section are located at
snippets/08/ex5-select-data/ in the code package of this book. When using the interactive snippet playground, select 8: Web SQL Database and Example 5.
At its simplest, a
SELECT statement looks as follows:
SELECT fieldName[, ...] FROM tableName[, ...] [WHERE condition[ ...]] [ORDER BY field [direction], ...]
There's a ...