WEBVTT

00:00.000 --> 00:07.000
Data Manipulation Language DML

00:07.000 --> 00:10.000
In this video, we will understand.

00:10.000 --> 00:16.000
Define what data manipulation language DML is and explain its purpose in managing data.

00:16.000 --> 00:21.000
Identify and apply the main DML commands, insert, update, and delete.

00:21.000 --> 00:29.000
Recognize the importance of data integrity and safe data handling using transactions.

00:29.000 --> 00:33.000
What is data manipulation language?

00:33.000 --> 00:41.000
Data manipulation language, or DML, is a part of SQL that helps us work with the data stored in tables.

00:41.000 --> 00:47.000
It allows us to add, change, or remove information without changing the table structure.

00:47.000 --> 00:51.000
The main DML commands are insert, update, and delete.

00:51.000 --> 00:54.000
Think of DML like managing a library catalog.

00:54.000 --> 01:03.000
You can add new books, update their information, or remove old books that are no longer available.

01:03.000 --> 01:06.000
Types of DML commands

01:06.000 --> 01:13.000
First up is insert. The insert command is how we introduce new records or rows into a table.

01:13.000 --> 01:16.000
Think of it as adding a new user.

01:16.000 --> 01:19.000
It helps your database grow with fresh information.

01:19.000 --> 01:24.000
For example, the insert command adds new entries to a table.

01:24.000 --> 01:32.000
Here we add three employees, John Doe, Jane Smith, and Sam Green, with their salaries.

01:32.000 --> 01:38.000
After running select star from employees, all three records appear in the database.

01:38.000 --> 01:43.000
It's like adding new team members to your company records.

01:43.000 --> 01:45.000
Next is the update command.

01:45.000 --> 01:51.000
This is vital for making corrections or improvements to data that is already in your table.

01:51.000 --> 01:59.000
Here, we're updating John Doe's salary to 5,500 using his employee ID 101.

01:59.000 --> 02:03.000
Next, we update Jane Smith's record.

02:03.000 --> 02:09.000
Changing her salary to 8,000 and shortening her name to Jane S.

02:09.000 --> 02:18.000
With the WHERE clause, only those specific records are modified, keeping all other data safe.

02:18.000 --> 02:21.000
Finally, we have the DELETE command.

02:21.000 --> 02:24.000
This is used to remove records that are no longer needed.

02:24.000 --> 02:30.000
In this example, we're deleting the employee with ID 103 from the employee's table.

02:30.000 --> 02:36.000
By using the WHERE clause, we make sure only that specific employee's record is deleted.

02:36.000 --> 02:39.000
Nothing else is affected.

02:39.000 --> 02:46.000
This keeps the database organized and free of outdated information.

02:46.000 --> 02:48.000
Ensuring data integrity.

02:48.000 --> 02:53.000
To keep data safe and correct, we use constraints in foreign keys.

02:53.000 --> 02:56.000
They make sure information stays consistent.

02:56.000 --> 03:00.000
For example, no two employees can have the same ID.

03:00.000 --> 03:04.000
A transaction is a group of SQL actions that work together.

03:04.000 --> 03:07.000
Transactions have three main steps.

03:07.000 --> 03:10.000
Begin, starts, the operation.

03:10.000 --> 03:16.000
Commit, saves the changes, and roll back, cancels them if something goes wrong.

03:16.000 --> 03:19.000
Either all changes happen or none do.

03:19.000 --> 03:23.000
This ensures that our data always stays reliable.

03:23.000 --> 03:29.000
Data manipulation language lets us safely add, update, or remove data.

03:29.000 --> 03:33.000
Understanding DML helps us manage information effectively

03:33.000 --> 03:36.000
and is the foundation of every database system.

