The correct command to delete a column 'Category' from a table 'Products' is:

D. Alter table products drop column category

This command uses the ALTER TABLE statement with the DROP COLUMN clause. It specifies the table name ('products') and the column name ('category') to be removed.

Let's break down why the other options are incorrect:

  • A. Alter table products delete column category: While ALTER TABLE is used, DELETE COLUMN is not a valid SQL command for removing columns.
  • B. Alter table delete column category from product: The syntax is incorrect. The FROM clause is unnecessary in this context.
  • C. None of them: This is incorrect, as option D provides the correct command.
How to Delete a Column from a Table in SQL

原文地址: https://www.cveoy.top/t/topic/nwVf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录