SQL - Query (SELECT)

> (Data|State) Management and Processing > (Data Type|Data Structure) > (Relation|Table) - Tabular data > Structured Query Language (SQL)

1 - About

A query is a SQL statement that begins with the SELECT word.

See SQL - Select

A stored query is called a view.

The result of a query is stored in a result table, called the result-set.


3 - Equal

4 - Class

4.1 - ad-hoc

Users connected to the system send individual queries that are not known in advance. The system's administrator (DBA) cannot optimize the system specifically for this set of queries. Consequently, execution time for those queries can be very long.

Impromptu queries are constructed to answer immediate and specific business questions. The central difference between ad hoc queries and reporting queries is the limited degree of foreknowledge that is available to the System Administrator (SysAdmin) when planning for an ad hoc query.


4.1.1 - Olap

OLAP queries allow for the exploration and analysis of business data to discover new and meaningful relationships and trends. While this class of queries is similar to the “Ad hoc Queries” class, it is distinguished by a scenario-based user session in which a sequence of queries is submitted. Such a sequence may include both complex and simple queries.

4.1.2 - Data mining

joins and large aggregations that return large data result sets for possible extraction.

4.2 - reporting

Query are very well known in advance. As a result, the DBA can optimize the system specifically for these queries to execute them very rapidly by using clever data placement methods (e.g. partitioning and clustering) and auxiliary data structures (e.g. materialized views and indexes).

Reporting queries are executed periodically to answer well-known, pre-defined questions about the financial and operational health of a business. Although reporting queries tend to be static, minor changes are common. From one use of a given reporting query to the next, a user might choose to shift focus by varying a date range, geographic location or a brand name.


5 - Documentation / Reference