SAN JOSÉ STATE UNIVERSITY
ECONOMICS DEPARTMENT
Thayer Watkins
Standard/Structured Query Language
The syntax of SQL statements is simple although inelegant. The most
important type is a SELECT query, which is of the form:
- SELECT Select_List
- FROM table_names_list
- [WHERE search_creteria]
- [ORDER BY column_criteria [ASC | DESC]]
Explanation
- The Select_List (fields names separated by commas) determines which fields (columns) appear in
the resulting table.
- The table_names_list in the FROM gives the
table or tables that are used in forming the resulting table.
- The search_criteria in the optional WHERE line gives the
condition, if any, for including a particular row in the tabulation.
- The optional ORDER BY line tells how the results should be arranged
(ordered) and the column to be used for the ordering and whether it
should be an ascending or descending ordering.
There are qualifiers which may precede the Select_List.
These qualifiers are of the form [ALL | DISTINCT | DISTINCTROW] [ TOP n [PERCENT]]
which determine whether all rows or only distinct rows will be used. The
selection can also be limited to the top n or the top n percent of the rows.
WATKINS HOME PAGE