SQL: How to Delete a Column from a Table
The correct command to delete the 'Category' column from the 'Products' table is:
C. Alter table products drop column category
Explanation:
- ALTER TABLE is the SQL command used to modify the structure of an existing table.
- DROP COLUMN is the clause used to remove a column from the table.
Why other options are incorrect:
- A. Alter table delete column category from product: This syntax is incorrect. SQL doesn't use the keyword 'delete' to remove columns.
- B. Alter table products delete column category: Similar to option A, 'delete' is not the appropriate keyword for column removal.
Example:
ALTER TABLE Products DROP COLUMN Category;
This command will remove the 'Category' column from the 'Products' table.
原文地址: https://www.cveoy.top/t/topic/nwRQ 著作权归作者所有。请勿转载和采集!