One of the most important operations done while connected to a database is the query. In database terms, a query
is a request to retrieve data from a database table or tables. Queries can range in complexity from simple queries, consisting of a few lines, to extremely long and intricate reports composed of pages of code. Queries form the backbone of business reporting and, as such, are a vital part of the SQL language. We compose queries using the SELECT
statement, as discussed in this section.
Now that we have laid out some of the syntactical rules for SQL statements, it is time to learn about the structure of our first SQL statement. We see what is commonly referred to as a "syntax tree" for a SELECT
statement, shown as follows:
SELECT {column, …} [*] FROM {table}];
In this example, we denote keywords , or basic statement components, in uppercase. Again, recall that SQL statements are case-insensitive and that...