If DDL is about designing the house, DML - Data Manipulation Language - is about moving the furniture in and out. It’s how you work with the actual data inside tables.
1. The Four Core DML Commands
- SELECT - read data.
- INSERT - add new rows.
- UPDATE - change existing rows.
- DELETE - remove rows.
2. SELECT: Reading Data Clearly
SELECT is the command you’ll use the most as an analyst. It answers: “What does the data look like?”
SELECT column1, column2 FROM table_name WHERE condition ORDER BY column1;
As a beginner, start by selecting specific columns and adding a small WHERE filter, so you are not overwhelmed by giant result sets.
3. INSERT: Adding New Data
INSERT INTO customers (customer_id, customer_name, email) VALUES (1, 'Ada Lovelace', 'ada@example.com');
Notice how the list of columns after the table name matches the order of the values. In many real systems, INSERT is done by applications, but understanding it helps you follow how data is created.
4. UPDATE: Changing Rows Safely
UPDATE customers SET email = 'ada.lovelace@example.com' WHERE customer_id = 1;
The WHERE clause is critical. Without WHERE, UPDATE touches every row in the table. A good habit: first run a SELECT with the same WHERE to confirm which rows you will affect.
5. DELETE: Removing Rows Carefully
DELETE FROM customers WHERE customer_id = 1;
Again, WHERE protects you. In many teams, DELETE is restricted or replaced with a 'soft delete' using an is_active or status column so rows are hidden, not destroyed.
6. DML and Data Cleaning
When you fix dirty data at the source, you often use UPDATE to correct values, and sometimes INSERT to backfill missing rows. DML is the practical side of cleaning: it turns your checks and findings into real corrections inside the table.
Try it yourself
INSERT INTO is Level 44, in Chapter 7: Creating and changing tables.
The first 5 levels are free · no sign-up needed