O'Reilly logo

Microsoft® SQL Server™ 2000 Programming by Example by Carlos Eduardo Rojas, Fernando G. Guerrero

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Querying Data

One of the main purposes of a database is to have a repository or a data storage system where information can be extracted quickly. The SQL statement used to extract information from tables in a database is the SELECT statement.

The SELECT Statement

The SELECT statement is used to extract information from the database or, in other words, to ask questions (or queries) to the database.

The clauses or elements of the SELECT statement are FROM, WHERE, ORDER BY, GROUP BY, HAVING, TOP, and INTO. The only element that is always required for queries is the FROM clause, which is used to specify the table or view from which to extract information.

The basic syntax of SELECT is

SELECT column_list
FROM Table_name

When you issue a SELECT

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required