1.7. Structure of a SQL Statement
A SQL statement can be broken into three major components:
The SQL operation
The target
The condition
Only the first two components are required; the condition is optional or may not apply, depending on the SQL operation being performed.
1.7.1. The SQL Operation
There are four basic operations performed by a SQL DML statement. Each of these is discussed in this section. Each operation is also the name of a SQL statement, and the detailed syntax for each statement can be found in Chapter 3.
1.7.1.1. SELECT
The SELECT statement is probably the most common and widely used of all SQL statements. The purpose of a SELECT statement is to retrieve data from the database. The statement may return data elements from one or more database tables or views, from expressions involving data elements from at least one database table or view and/or constant, or from constants. A SELECT statement always has a target component, and often has a condition component. The target of a SELECT statement is the set of tables and views listed in the FROM clause (the tables and views from which data is retrieved). The condition is the expression in the WHERE clause, and possibly in the HAVING clause as well, that restricts the rows that will be returned. If no condition is specified, all rows of the target table(s) and/or view(s) are returned.
1.7.1.2. INSERT
The INSERT statement creates new rows of data in a target database table or view. The statement provides a list ...
Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.