Make Some Changes
Explore how to use SQL's insert, update, and delete commands to add, modify, and remove data safely. Learn to maintain clean and accurate datasets essential for reliable data analysis and decision-making.
As data analysts, we don’t just explore and visualize data, we often need to clean it, fix inconsistencies, or update values to reflect new information. Whether we’re correcting a typo, removing duplicate entries, or adding new records for analysis, SQL’s DML commands, like INSERT, UPDATE, and DELETE, are essential tools in our workflow.
They may seem basic, but these commands give us precise control over our data. Used thoughtfully, they help keep datasets accurate, current, and ready for confident analysis.
Sample table
Before we dive in, meet the table we’ll be working with. Think of it as a temporary parking spot for incoming product data before it’s transformed and pushed to production.
Product_id | Name | Price | Stock | Discontinued |
1 | T-shirt | 19.99 | 50 | false |
2 | Jeans | 49.99 | 20 | false |
3 | Baseball cap | 15.00 | 0 | true |
1. The INSERT statement
When we need to add new data to a table, like a new ...
INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
...