0% found this document useful (0 votes)
243 views16 pages

DML and Transaction Control Overview

This document provides an overview of data manipulation language (DML) statements and transaction control in database systems. It defines DML as statements that add, modify, or remove data from tables. The key DML statements are INSERT to add rows, UPDATE to modify rows, and DELETE to remove rows. A transaction combines a series of DML statements into a single logical unit of work. The document describes the basic syntax of each DML statement and how they are used to manipulate data in database tables.

Uploaded by

Akademiko Helper
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
243 views16 pages

DML and Transaction Control Overview

This document provides an overview of data manipulation language (DML) statements and transaction control in database systems. It defines DML as statements that add, modify, or remove data from tables. The key DML statements are INSERT to add rows, UPDATE to modify rows, and DELETE to remove rows. A transaction combines a series of DML statements into a single logical unit of work. The document describes the basic syntax of each DML statement and how they are used to manipulate data in database tables.

Uploaded by

Akademiko Helper
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

INFORMATION MANAGEMENT

MODULE 7: Data Manipulation Language (DML)


and Transaction Control
MODULE 7 SUBTOPIC 1

Overview of DML

■At the end of the chapter, the learner should be able to:
• Define terms
• Describe each data manipulation language (DML) statement
• Insert, update, and delete data
• A DML statement is executed when you:
• Add new rows to a table
• Modify existing rows in a table
• Remove existing rows from a table
• A transaction consists of a collection of DML statements that form a
logical unit of work.

Database Systems 1
New
DEPARTMENTS row

Insert new row


into the
DEPARTMENTS table.
• Add new rows to a table by using the INSERT statement:
INSERT INTO table [(column [, column...])]
VALUES (value [, value...]);

• With this syntax, only one row is inserted at a time.


Adds one or more rows to a table
Inserting into a table

Inserting a record that has some null attributes requires identifying the
fields that actually get data

Inserting from another table


Introduced with SQL:2008

Inserting into a table does not require explicit customer ID entry or field list

INSERT INTO CUSTOMER_T VALUES ( ‘Contemporary Casuals’, ‘1355 S. Himes


Blvd.’, ‘Gainesville’, ‘FL’, 32601);
•Use & substitution in a SQL statement to prompt for values.
•& is a placeholder for the variable value.
INSERT INTO departments
(department_id, department_name, location_id)
VALUES (&department_id, '&department_name',&location);
EMPLOYEES

Update rows in the EMPLOYEES table:


•Modify existing values in a table with the UPDATE
statement: UPDATE table
SET column = value [, column = value, ...]
[WHERE condition];

•Update more than one row at a time (if required).


Modifies data in existing rows
DEPARTMENTS

Delete a row from the DEPARTMENTS table:


You can remove existing rows from a table by using the DELETE
statement:
DELETE [FROM] table
[WHERE condition];
Removes rows from a table
Delete certain rows
• DELETE FROM CUSTOMER_T WHERE CUSTOMERSTATE = ‘HI’;
Delete all rows
• DELETE FROM CUSTOMER_T;
Makes it easier to update a table…allows combination of Insert and
Update in one statement

Useful for updating master tables with new data


END OF SUBTOPIC 1

You might also like