100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
SQL Mastery
35 minbeginner

INSERT, UPDATE & DELETE

Until now you have only read data, but real databases change constantly: new matches are recorded, scores are corrected, obsolete records are removed. The three Data Manipulation Language statements, INSERT, UPDATE, and DELETE, are how you write to a database. Together they let you add rows, change existing ones, and remove rows, turning a static dataset into a living system that reflects reality.

These statements are powerful precisely because they alter stored data permanently. A misplaced UPDATE can overwrite thousands of rows, and a DELETE without a WHERE clause can empty an entire table in an instant. That power demands discipline: a clear WHERE clause, an understanding of how many rows each statement affects, and the transactional safety net covered in the next lesson.

Mastering DML is the difference between querying a database and operating one. Applications insert on every signup, update on every edit, and delete on every removal, often thousands of times per second. Writing these statements correctly, targeting exactly the intended rows and respecting the table's constraints, is fundamental to keeping a database accurate, consistent, and trustworthy under constant change.

Analogy🏏Cricket
🏏 Think of it like cricket: Imagine the end of an IPL innings when the scorer announces the team's final total. Just as the scorer does not read out all one hundred and twenty individual deliveries but instead sums them into a single team score, SUM folds many row values into one number. Just as the commentator reports the highest individual score, the average partnership, and the number of wickets, MAX, AVG, and COUNT each summarise the innings differently. Just as a not-out batsman with no deliveries faced does not lower the team average, aggregates skip NULLs when computing. Just as the announcement is one figure no matter whether the innings had fifty deliveries or two hundred and fifty, an aggregate collapses any number of rows into a single result. This reveals why summaries answer the questions about the whole that individual deliveries cannot.
Lesson 25 of 35
0% complete