The SQL SELECT statement returns a result set of records from one or more tables or views.
It retrieves zero or more rows from one or more base tables, temporary tables, or views in a database.
SELECT * FROM TABLE_NAME
SELECT column1, column2 FROM TABLE_NAME
The SELECT statement has many optional clauses:
- WHERE specifies which rows to retrieve.
- GROUP BY groups rows sharing a property so that an aggregate function can be applied to each group.
- HAVING selects among the groups defined by the GROUP BY clause.
- ORDER BY specifies an order in which to return the rows.