When writing a T-SQL statement, the following three actions are required:
- Express the intended operation, such as reading or changing data
- Provide a target or source list of affected tables
- Provide a condition that filters the affected records
The intended operation is determined by the presence of the following clauses:
- The SELECT clause lists columns or expressions that will be displayed in the result set
- The DELETE, INSERT, or UPDATE clauses state the target table or view for these logical operations
As for the affected tables and filters, they are determined by the following clauses:
- The FROM clause lists the source tables, views and/or sub-queries that contain the data to be queried
- The WHERE clause states one or more conditions that will serve to filter the result set to the desired rows
The preceding clauses determine which data...