The SQL-data change statements are INSERT, UPDATE and DELETE. Many
people call these the SQL "update" statements — which
is okay, provided you don't mix up "update" (lower case, meaning INSERT or
UPDATE or DELETE) with UPDATE (upper case, meaning only
UPDATE). We prefer the term "data change statements" because it's
unambiguous.
In this chapter, we'll discuss changes to SQL-data in all aspects, including
hidden changes, changes of Views, the syntax of INSERT, UPDATE and
DELETE, access (Privilege) rules and the new SQL3 feature: changes to
joined Tables. But we won't talk about four important and relevant matters
because they rate chapters of their own:
Multiple data changes and transactions discussed in Chapter 36 "SQL Transactions".
Data changes and Constraints discussed in Chapter 20 "SQL Constraints and Assertions".
Data changes and Triggers discussed in Chapter 24 "SQL Triggers".
Data changes through Cursors discussed in Chapter 39 "Embedded SQL Binding
Style" — in particular, data changes with "positioned"
UPDATE/DELETE.
After reading this chapter, you'll know everything that there is to know about the SQL data-change statements taken in isolation. But we give you fair warning: we'll revisit some of these points when we put them in context later on.
-
The SQL-data Change Statements
In SQL, there are fundamentally only three conceivable data-change operatio... -
INSERT Statement
The INSERT statement's job is to tentatively add new rows to a Table. If IN... -
INSERT Column list
In the first form of INSERT, you can optionally specify a parenthesized obj... -
< query expression >
The <query expression> that makes up the first form of INSERT is usually a ... -
DEFAULT VALUES
You can write your INSERT statement with the <keyword>s DEFAULT VALUES inst... -
INSERT Examples
Here are some examples of INSERT statements. First, let's assume that two T... -
INSERT Physics
Most DBMSs simply append newly inserted rows to the end of the target Table... -
UPDATE Statement
The UPDATE statement's job is to tentatively edit existing rows in a Table.... -
SET Column
In the first form of UPDATE — UPDATE < Table > SET <Column>=<value> — you m... -
SET ROW
In the second form of UPDATE — UPDATE < Table > SET ROW=row_expression — yo... -
UPDATE Examples
To change the last row in AUTHORS_1 so that the ID Column is the last ID be... -
UPDATE Physics
Most DBMSs fit a changed row in the same place as the old one — a good idea... -
DELETE Statement
The DELETE statement's job is to tentatively remove existing rows from a Ta... -
DELETE Examples
Here's some examples of DELETE statements: DELETE FROM Authors_1 WHERE name = name; -- del -
DELETE Physics
With most DBMSs, a deleted row disappears from view in the Table, but actua... -
Data Change Operations
Generalizing shamelessly, we compare here the steps required to do an UPDAT... -
Bulk Changes
A bulk change is an operation that affects a significant percentage of the ... -
Dialects
Data change is a stable section of SQL. All vendors support it, few vendors...