Chapter 7
copy a table using select statement
When you use the SELECT statement to create a table, only the column definitions and data are copied. Definitions of primary keys, foreign keys, indexes, default values, and so on are not included in the new tabl
The INSERT statement example
The INSERT statement that follows inserts INSERT INTO Download (UserID, DownloadDate, DownloadFilename, ProductCode) VALUES (1, NOW(), 'jr01_filter.mp3', 'jr01')
transaction
A transaction is a group of SQL statements that must all be executed together. By default, Oracle adds INSERT, UPDATE, and DELETE statements to a transactio transaction is a group of SQL statements that must all be executed successfully before they are saved to the database. To make the changes to the database permanent, you must explicitly commit the changes to the database. Otherwise, you can undo, or rollback, the changes.
insert statement
Adds one or more records to any single table in a relational database. In the INSERT clause, you specify the name of the table that you want to add a row to, along with an optional column list. The INTO keyword is required
DELETE Statement
The DELETE statement is used to delete rows in a table. DELETE FROM table_name WHERE some_column=some_value; Notice the WHERE clause in the SQL DELETE statement! The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
Update statement
The UPDATE statement is used to update existing records in a table. UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value; Notice the WHERE clause in the SQL UPDATE statement! The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
insert subquery
You can code a subquery in the SET or WHERE clause of an UPDATE statement. • You can use a subquery in the SET clause to return the value that's assigned to a column. • You can code a subquery in the WHERE clause to provide one or more values used in the search condition.