CBSE Class 11 Informatics Practices
Question 60 of 87
Structured Query Language (SQL) — Question 21
Back to all questions(a) Differences between ALTER and UPDATE statements:
| ALTER statement | UPDATE statement |
|---|---|
| The ALTER statement is used to modify the structure of database objects, such as tables, views, or schemas. | The UPDATE statement is used to modify the existing data in a table. |
| It can be used to add, modify, or drop columns, constraints, or indexes in a table. | It is used to change the values of one or more columns in a table based on specified conditions. |
For example: ALTER TABLE Employees ADD Email VARCHAR(255); | For example: UPDATE Employees SET Email = 'john.doe@example.com' WHERE EmployeeID = 101; |
(ii) Differences between DELETE and DROP statements:
| DELETE statement | DROP statement |
|---|---|
| The DELETE statement is used to remove one or more rows from a table based on specified conditions. | The DROP statement is used to remove entire database objects, such as tables, views, indexes, or schemas, from the database. |
| It deletes specific rows of data while keeping the table structure intact. | It deletes the entire object along with its structure and data. |
For example, DELETE FROM Employees WHERE Department = 'Marketing'; | For example, DROP TABLE Products; |