In Chapter 2, SQL SELECT Statements, we began with a simple SELECT... FROM
statement. We then began adding clauses to accomplish different goals. With the addition of the HAVING
clause, we come to the end of the essential clauses used in SELECT
statements. While we will still explore other types of SQL statements and the techniques used with them, there are no more new clauses to add to the collection of SQL statements we use to query data. A proper syntax tree that combines all of the clauses for SELECT
statements that we have seen throughout this book is shown as follows:
SELECT {column, column, …} FROM {table} WHERE {expression} GROUP BY {expression} HAVING {expression} ORDER BY {column};
Nearly every SQL statement we can write involves taking these clauses and integrating them in ways that answer a particular question that we pose to the database. We close this chapter with an example that brings together each of the clauses we have seen. In it, we display login...