Components of query specification, query expression in SQL

Query specification: It is a building block for queries in SQL. It is used to describe how data can be combined from tables in FROM clause to a table of query results.

Here are the components of a query specification:

1) Select statement is used for describing columns of query results. Every column is specified by an expression.

2) Optional alias can be assigned to a column by using AS clause.

3) FROM clause is used to specify tables which are used for generating query results.

4) WHERE clause is used to determine which rows will be selected for query results.

5) ALL and UNIQUE keywords are used to specify whether rows will retain or remove duplicates.

6) GROUP BY and HAVING clauses are used to make groups of individual query results. They are also used for selecting row groups to be included in query results.

Query expression: A query expression is used to specify a table of query results. In a query expression, query specification is used to generate table of query results. Table value constructor is used for generating table of created values and explicit table reference value is used for creating contents of the named table.

Leave a Reply