Question: The SELECT statement is formed by at least two clauses: the SELECT clause and the FROM clause. The clauses WHERE and ORDER BY are optional.
The SELECT statement is formed by at least two clauses: the SELECT clause and the FROM clause. The clauses WHERE and ORDER BY are optional. Observe that the SELECT statement, like any other SQL statement, ends in a semicolon. The functions of each these clauses are summarized as follows:
- The SELECT clause lists the columns to display. The attributes listed in this clause are the columns of the resulting relation.
- The FROM clause lists the tables from which to obtain the data. The columns mentioned in the SELECT clause must be columns of the tables listed in the FROM clause.
- The where clause specifies the condition or conditions that need to be satisfied by the rows of the tables indicated in the FROM clause.
- The ORDER BY clause indicates the criterion or criteria used to sort rows that satisfy the WHERE clause. The ORDER BY clause only affects the display of the data retrieved, not the internal ordering of the rows within the tables.
As a mnemonic aid to the basic structure of the SELECT statement, some authors summarize its functionality by saying that "you SELECT columns FROM tables WHERE the rows satisfy certain condition, and the result is ORDERED BY specific columns." Based on your place of employment, hobby, or other interest, create a SELECT statement using all the clauses shown above. In addition to the statement, share for which database you created the statement. Then, compare, contrast, and evaluate your statement with one for a different database. Are they similar? Are there any syntax differences?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
