Chap08.pdf - CSC 4710 CSC 6710 Database Systems When needed we will use them*Material based on Fundaments of DATABASE SYSTEMS 7th Edition(Elmasri

Chap08.pdf - CSC 4710 CSC 6710 Database Systems When needed...

This preview shows page 1 - 13 out of 123 pages.

CSC 4710 / CSC 6710 Database Systems Rao Casturi *Material based on Fundaments of DATABASE SYSTEMS 7 th . Edition (Elmasri & Navathe) ** Additional comments, slides are added by Rao Casturi When needed we will use them
Basic SQL Retrieval Query Block Rao Casturi - GSU - Database Systems 2
SQL INSERT, DELETE, UPDATE Rao Casturi - GSU - Database Systems 3
INSERT, DELETE, and UPDATE Statements in SQL Three commands used to modify the database: INSERT , DELETE , and UPDATE INSERT typically inserts a tuple (row) in a relation (table) UPDATE may update a number of tuples (rows) in a relation (table) that satisfy the condition DELETE may also update a number of tuples (rows) in a relation (table) that satisfy the condition Rao Casturi - GSU - Database Systems 4
INSERT In its simplest form, it is used to add one or more tuples to a relation Attribute values should be listed in the same order as the attributes were specified in the CREATE TABLE command Constraints on data types are observed automatically Any integrity constraints as a part of the DDL specification are enforced Rao Casturi - GSU - Database Systems 5
The INSERT Command Specify the relation name and a list of values for the tuple. All values including nulls are supplied.The variation below inserts multiple tuples where a new table is loaded values from the result of a query. Rao Casturi - GSU - Database Systems 6
BULK LOADING OF TABLES Another variation of INSERT is used for bulk-loading of several tuples into tables A new table TNEW can be created with the same attributes as T and using LIKE and DATA in the syntax, it can be loaded with entire data. EXAMPLE: CREATE TABLE D5EMPS LIKE EMPLOYEE ( SELECT E.* FROM EMPLOYEE AS E WHERE E.Dno=5) WITH DATA ; Rao Casturi - GSU - Database Systems 7
Rao Casturi - GSU - Database Systems 8