A SQL statement can be broken into three major components:
The SQL operation
Only the first two components are required; the condition is optional or may not apply, depending on the SQL operation being performed.
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.
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.
The INSERT statement creates new rows of data in a target database table or view. The statement provides a list ...