Database Reference
In-Depth Information
4
The SELECT Statement
In this chapter:
How do you write a basic query using SELECT statements?
What types of SELECT statements are possible?
What else is interesting about SELECT statements?
In this chapter, we dive right into the syntax and use of the SELECT
statement to query the database. We also briefly discuss different types of
queries, finally examining specific aspects of queries such as using DIS-
TINCT and the DUAL table. So let's begin with the basics of the SELECT
statement and some simple examples just to get into the swing of things.
4.1
The Basic SELECT Statement
SELECT is the beginning of the SQL command for querying (retrieving)
data from a database table, view, or object. Objects are similar to tables, but
they have a more complex structure.
4.1.1
Uses of the SELECT Statement
The SELECT statement is a specialized way to ask a question about the
data in a database. Thus a SELECT statement is also called a query
because it quite literally “queries” or asks questions of a database. There
are several uses for the SELECT statement that give you great flexibility
in the database:
Simple query
. A SELECT statement can be used alone to retrieve
data from a table or a group of related tables. You can retrieve all col-
Search WWH ::




Custom Search