SELECT is probably the most frequently used SQL statement. It specifies the table columns from which to obtain the data you want, the corresponding database (if different from the current default database), and the table or tables that you need to reference within that database.
The SELECT statement further specifies how, in what format, and in what order the system returns the set of result data.
You can use the following options, lists, and clauses with the SELECT statement to request data from Teradata Database. The list is not exhaustive.
- DISTINCT option
- FROM clause
- WHERE clause, including subqueries
- GROUP BY clause
- HAVING clause
- QUALIFY clause
- ORDER BY clause
- CASESPECIFIC option
- International sort orders
- WITH clause
- Query expressions and set operators
Another variation is the SELECT INTO statement, which is used in embedded SQL and stored procedures. This statement selects at most one row from a table and assigns the values in that row to host variables in embedded SQL or to local variables or parameters in Teradata Database stored procedures.