Chapter 4. SELECT
When working with databases and SQL, the most common task is to request data from one or more tables and display it. The SELECT statement accomplishes this. But the SELECT can do far more than simply retrieve and display data. As we will learn in coming chapters, we can transform this data in meaningful ways and build powerful summaries from millions of records.
But first, we will learn how to SELECT columns from a single table as well as compose expressions in them.
Retrieving Data with SQL
If you have not done so already, click on Tools→Open SQL Editor in the top menu, and make sure the rexon_metals database is open, as mentioned in the previous chapter. Your SQLiteStudio workspace should look something like Figure 4-1. Notice that the SQL workspace is now divided into two panes, a SQL Editor pane and a Query Results pane.
Figure 4-1. The SQL workspace
The SQL Editor pane is where you will write your SQL, and the Query Results pane will display the results of your SQL.
Let’s write our first SQL statement. The most common SQL operation is a SELECT statement, which pulls data from a table and then displays the results. Click on the SQL Editor pane and write the following statement:
SELECT*FROMCUSTOMER;
Click the blue triangle button or hit F9 to execute the SQL.
You just ran your first query, and the results should be displayed in the bottom pane (Figure 4-2 ...