MySQL + SQL · Lesson 52
UPDATE and DELETE Commands
UPDATE — Change Data
UPDATE students SET marks = 95 WHERE roll_no = 1;Changes marks to 95 for roll_no 1 only.
DELETE — Remove Rows
DELETE FROM students WHERE roll_no = 5;Deletes the row(s) matching the condition.
The Most Important Rule
ALWAYS use
WHERE with UPDATE/DELETE. DELETE FROM students; with no WHERE deletes EVERY row!Summary
- UPDATE changes existing rows; DELETE removes rows.
- Always add WHERE, or the whole table is affected.
💻 Live Code Editor
Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.