RSS Feed

SQL SELECT

SQL SELECT

The SELECT statement is used to select data from a database.

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

SQL SELECT Syntax

SELECT column_name(s)
FROM table_name

[Source]

The SQL statement below shows a simple usage of the SQL SELECT command:

SELECT FirstName, LastName, DateOfBirth
FROM Employees

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. [Wikipedia]