Exercises · Q7
Q.Differentiate between the following commands:
a) ALTER and UPDATE
b) DELETE and DROP
Puducherry CbseNCERTSubjective· 3mImportance★★★★★est
73% · 33/45 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Both pairs split along the same fault line — structure vs data. ALTER (DDL) changes a table's structure while UPDATE (DML) changes the data inside it; DROP (DDL) removes the entire table, definition and all, while DELETE (DML) removes only rows, leaving the empty table standing.
a) ALTER vs UPDATE
| Basis | ALTER TABLE | UPDATE |
|---|---|---|
| Category | DDL (Data Definition Language) | DML (Data Manipulation Language) |
| Acts on | The table's structure (schema) | The data in existing rows |
| Typical uses | Add/drop/rename a column, change a data type, add a constraint | Change the values stored in one or more rows |
| Needs the table's data to exist? | No — works even on an empty table | Yes — it modifies existing rows |
Seen side by side on the same table:
ALTER TABLE student ADD email VARCHAR(50); -- structure: a NEW column appears
UPDATE student SET class = 12 WHERE rollno = 101; -- data: one existing value changes
After the ALTER, every row has a new (initially NULL) email column — the shape of the table changed. After the UPDATE, the shape is untouched; only the class value of row 101 changed. The WHERE clause is what confines UPDATE to specific rows — omit it and all rows are updated.
b) DELETE vs DROP
| Basis | DELETE | DROP |
|---|---|---|
| Category | DML | DDL |
| Removes | Rows (some or all, via WHERE) | The whole object — table definition and all its data (or an entire database) |
| Table structure afterwards | Still exists (can be empty) | Gone — querying it errors |
| Can target specific rows? | Yes — WHERE clause | No — all-or-nothing |
DELETE FROM student WHERE rollno = 101; -- removes one row; table remains
DELETE FROM student; -- removes ALL rows; empty table remains
DROP TABLE student; -- removes the table itself
``` …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.