SQL Command to Rename a Table: 'Products' to 'Items'
The correct command to rename a table from 'Products' to 'Items' in SQL is:
A. Alter table Products rename to Items
This command modifies the table definition and changes the name from 'Products' to 'Items'.
Explanation:
- Alter table is the SQL keyword used to modify the structure of an existing table.
- rename to is a sub-clause used to specify the new name for the table.
Incorrect Options:
- B. Alter table change name product to items: This command is incorrect as there is no 'change name' sub-clause in SQL for renaming tables.
- C. None of them: This option is incorrect as option A is the correct command.
- D. Alter table Items rename ot product: This option is incorrect because it attempts to rename 'Items' to 'product' instead of the other way around.
Important Note: The exact syntax for the 'ALTER TABLE' command can vary slightly depending on the specific database system you are using. However, the core functionality remains the same.
原文地址: https://www.cveoy.top/t/topic/nwQW 著作权归作者所有。请勿转载和采集!