The correct command to rename a table from 'Products' to 'Items' in SQL is:

A. Alter table Products rename to Items

Explanation:

The ALTER TABLE command is used to modify existing tables in a database. The RENAME TO clause is used to change the name of the table. Here's the general syntax:

ALTER TABLE old_table_name RENAME TO new_table_name;

In this case, you would use:

ALTER TABLE Products RENAME TO Items;

Incorrect Options:

  • B. Alter table change name product to items: This syntax is incorrect. The CHANGE NAME clause is not a valid part of the ALTER TABLE command.
  • C. None of them: This is incorrect, as option A is the correct answer.
  • D. Alter table Items rename ot product: This would rename the table from 'Items' to 'Products', which is the opposite of what's required.
How to Rename a Table in SQL: 'Products' to 'Items'

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

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