...

/

Make Some Changes

Make Some Changes

Learn how to insert, update, and delete data safely and efficiently in your relational database.

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 product, customer, or transaction, we use the INSERT command. It allows us to create a new row in the table with specific values for each column. ...