Computer Science
Differentiate between the following statements:
(i) ALTER and UPDATE
(ii) DELETE and DROP
SQL Queries
5 Likes
Answer
(i) 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; | 
Answered By
2 Likes
Related Questions
- Site any two differences between Single Row Functions and Aggregate Functions. 
- What do you understand by Cartesian Product? 
- Write the name of the functions to perform the following operations: - To display the day like 'Monday', 'Tuesday', from the date when India got independence.
- To display the specified number of characters from a particular position of the given string.
- To display the name of the month in which you were born.
- To display your name in capital letters.
 
- Write the output produced by the following SQL statements: - (a) - SELECT POW(2, 3);- (b) - SELECT ROUND(342.9234, -1);- (c) - SELECT LENGTH("Informatics Practices");- (d) - SELECT YEAR("1979/11/26"), MONTH("1979/11/26"), DAY("1979/11/26"), MONTHNAME("1979/11/26");- (e) - SELECT LEFT("INDIA", 3), RIGHT("ComputerScience", 4), MID("Informatics", 3, 4), SUBSTR("Practices", 3);