SQL, DELETE, DROP, and ALTER are commands used for different purposes:
DELETE
Example (deleting all rows):
DELETE FROM employees;
Example (deleting specific rows):
DELETE FROM employees WHERE department = 'HR';
DROP
Example (dropping a table):
DROP TABLE employees;
Example (dropping a view):
DROP VIEW employee_view;
领英推荐
ALTER
Common ALTER operations:
ALTER TABLE employees ADD COLUMN salary DECIMAL(10, 2);
ALTER TABLE employees DROP COLUMN salary;
ALTER TABLE employees RENAME COLUMN old_name TO new_name;
ALTER TABLE employees ALTER COLUMN salary TYPE INT;
Key Differences (Summary):
Additional Notes:
These clarifications and examples should give you a more complete understanding of the differences between DELETE, DROP, and ALTER in SQL!