SQL Select Command
Used to retrieve selected data. Syntax:
SELECT [ALL | DISTINCT] columnname1 [,columnname2]
FROM tablename1 [,tablename2]
[WHERE condition] [ and|or condition...]
[GROUP BY column-list]
[HAVING "conditions]
[ORDER BY "column-list" [ASC | DESC] ]
The sections between the brackets [] are optional. A simpler syntax statement is:
select columnname1 [,columnname2] from tablename [where condition];
A "*" may be used to select all columns. The where clause is optional and only one column name must be specified.
The Where Clause
This clause is used to specify which columns and values are returned. Where conditions specify an OPERATOR to use for comparison. OPERATORs include:
The GROUP BY Clause
This "GROUP BY" clause allows multiple columns to be grouped so aggregate functions (listed below) may be performed on multiple columns with one command.
Aggregate function keywords:
|