Select (SQL)

Select (SQL)

The SQL SELECT statement returns a result set of records from one or more tables.

A SELECT statement retrieves zero or more rows from one or more database tables or database views. In most applications, SELECT is the most commonly used Data Manipulation Language (DML) command. As SQL is a declarative programming language, SELECT queries specify a result set, but do not specify how to calculate it. The database translates the query into a "query plan" which may vary between executions, database versions and database software. This functionality is called the "query optimizer" as it is responsible for finding the best possible execution plan for the query, within applicable constraints.

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.

Read more about Select (SQL):  Examples, Limiting Result Rows, Window Function, Query Evaluation ANSI

Famous quotes containing the word select:

    The director is simply the audience. So the terrible burden of the director is to take the place of that yawning vacuum, to be the audience and to select from what happens during the day which movement shall be a disaster and which a gala night. His job is to preside over accidents.
    Orson Welles (1915–1984)