Database Reference
In-Depth Information
Figure 4.13
Foreign key relationships.
4.5 Manipulating Data in Tables
You can manipulate the data in an existing table with DML commands. You can insert a row of
data with the INSERT command, modify data with the UPDATE command, delete data with the
DELETE command, and query data with the SELECT command. he following examples show
you how to use these commands to manipulate data in a table.
4.5.1 Inserting Data
To insert a new row of data in the table EMPLOYEE, use the following SQL statement:
INSERT INTO EMPLOYEE
VALUES(1, 'Liz', 'Chen')
As seen from the above SQL statement, the order and data types of the data values listed in the
VALUES (. . .) statement exactly match the column deinitions. For example, the data value of the
irst column is an integer; the irst name and last name data values are character strings that should
be quoted with single quotes.
4.5.2 Modifying Data
In this example, let us run the following SQL statement that will change the last name Chen to
Dean:
UPDATE EMPLOYEE
SET LastName = 'Dean'
WHERE LastName = 'Chen'
Search WWH ::




Custom Search