SQL SELECT Statement

(Redirected from SQL query)
Jump to navigation Jump to search

A SQL SELECT Statement is a data querying statement that is a SQL statement (expressed in a SQL language).



  • http://en.wikipedia.org/wiki/SQL#Queries
    • The most common operation in SQL is the query, which is performed with the declarative SELECT statement. SELECT retrieves data from one or more tables, or expressions. Standard SELECT statements have no persistent effects on the database. Some non-standard implementations of SELECT can have persistent effects, such as the SELECT INTO syntax that exists in some databases.[1]

      Queries allow the user to describe desired data, leaving the database management system (DBMS) responsible for planning, optimizing, and performing the physical operations necessary to produce that result as it chooses.

      A query includes a list of columns to be included in the final result immediately following the SELECT keyword. An asterisk ("*") can also be used to specify that the query should return all columns of the queried tables.

  • http://en.wikipedia.org/wiki/Select_%28SQL%29
    • The SQL SELECT statement returns a result set of records from one or more tables.[2][3]

      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.