12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Manipulating Data With <strong>SQL</strong> StatementsSee Also:■"Joins" in <strong>Oracle</strong> Database <strong>SQL</strong> Reference for information on usingSELECT with multiple tables.6.3 Manipulating Data With <strong>SQL</strong> StatementsData manipulation language (DML) statements query or manipulate data in existingschema objects. They enable you to:■■Add new rows of data into a table or view (INSERT)Change column values in existing rows of a table or view (UPDATE)■ Remove rows from tables or views (DELETE)DML statements are the most frequently used <strong>SQL</strong> statements.■ Adding Data With the INSERT Statement■ Updating Data With the UPDATE Statement■ Deleting Data With the DELETE Statement6.3.1 Adding Data With the INSERT StatementYou can use the <strong>SQL</strong> INSERT statement to add a row of data to a table. The datainserted must be valid for the data type and size of each column of the table.Example 6–8 shows how to use INSERT to add a row to the employees table. In thefirst INSERT statement, values are inserted into all columns in a row of the table.When you insert data into the columns, you must provide data values that are validfor the data type and size of the column.In the second INSERT statement, values are inserted only into the specified columns ofthe table and the remaining columns are set to NULL. If the those remaining columnshad been specified with a NOT NULL constraint for the table, an error would have beenraised. For information on constraints, see "Managing Tables" and ColumnConstraints.Example 6–8Using the INSERT Statement-- the following inserts data for all the columns in a rowINSERT INTO employees VALUES(300, 'Enrique', 'Belden', 'enrique.belden', '555.111.2222','01-AUG-05', 'AC_MGR', 9000, .1, 101, 110);-- the following inserts data into the columns specified by name-- NULLs are inserted in those columns not explicitly namedINSERT INTO employees (employee_id, last_name, email, hire_date, job_id, salary)VALUES (301, 'Doe', 'john.doe', '31-AUG-05', 'SH_CLERK', 2400);-- the following shows the rows were inserted beginning with 300SELECT employee_id, last_name FROM employees WHERE employee_id >= 300;See Also:■ <strong>Oracle</strong> Database <strong>SQL</strong> Reference for information on the INSERTstatement.<strong>SQL</strong>: Usage Information 6-7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!