Database Reference
In-Depth Information
umns or specify some columns. You can retrieve all rows or specify
which rows you want.
Complex query
. A SELECT statement can be embedded within
another SELECT statement. This lets you write a query within a
query. The possibilities are endless. Later chapters cover the details.
Create a view or table
. A SELECT statement can be used to create a
view or a new table. A view is a stored query that is executed when-
ever another SELECT statement retrieves data from the view by
using the view in a query. Views are very useful to enforce security by
limiting the columns or rows that particular users are allowed to see.
Insert, update, or delete data
. A SELECT statement can be used
within the INSERT, UPDATE, or DELETE statements to add
greater flexibility to these commands. Chapter 15 examines com-
mands for manipulating data.
Note:
There are numerous other more detailed types of queries using the
SELECT statement to be described briefly later in this chapter and in detail
in later chapters.
4.1.2
Syntax Conventions
In this section, and throughout the rest of the topic, you will see SQL and
SQL*Plus commands listed first with their syntax and then with many
examples, some of which you could type yourself to help you better under-
stand the commands.
The
of a command defines the set of rules governing the correct
form of a command. Some parts are required and never change, others are
optional, and others vary with each different statement. Figure 4.1 shows
the syntax of the basic SELECT statement with descriptions of the vari-
ous parts.
Here is the basic syntax of the SELECT statement in a textual form
(Backus-Naur Form), as shown in Figure 4.1. See Chapter 1 for details of
Backus-Naur syntax formatting.
syntax
SELECT { [alias.]column | expression | [alias.]* [ , … ] }
FROM [schema.]table [alias];
Search WWH ::




Custom Search