MySQL Worksheet 3 : RENAME Commands
Here’s a worksheet focused specifically on the RENAME
commands in MySQL, tailored for Class XII students. This worksheet includes various types of questions to help reinforce understanding
Name: ___________________
Date: ___________________
Part A: Multiple Choice Questions
Which command is used to rename a table in MySQL?
- a) RENAME TABLE
- b) ALTER TABLE ... RENAME
- c) CHANGE TABLE
- d) MODIFY TABLE
To rename a column in an existing table, which command would you use?
- a) ALTER COLUMN
- b) RENAME COLUMN
- c) ALTER TABLE ... CHANGE
- d) MODIFY TABLE ... RENAME
The syntax to rename a table from "OldTable" to "NewTable" is:
- a) RENAME TABLE OldTable TO NewTable;
- b) ALTER TABLE OldTable RENAME TO NewTable;
- c) CHANGE TABLE OldTable TO NewTable;
- d) MODIFY TABLE OldTable AS NewTable;
Part B: True/False Questions
T/F: You can rename multiple columns in a single ALTER TABLE command.
T/F: After renaming a table, all associated foreign keys automatically update to reflect the new name.
T/F: The RENAME command can be used to change the name of a database.
Part C: Fill in the Blanks
The SQL command to rename a table named "Students" to "Pupils" is __________.
To rename a column "LastName" to "Surname" in the "Employees" table, you would use __________.
The keyword used to specify the new name in the RENAME command is __________.
Part D: Short Answer Questions
Write the SQL command to rename the table "Orders" to "CustomerOrders".
Write the SQL command to change the column name "Address" to "HomeAddress" in the "Customers" table.
Explain the importance of using the RENAME command in database management.
Part E: Practical Application
Write a command to rename the table "Products" to "Inventory".
Write a command to rename the column "PhoneNumber" to "ContactNumber" in the "Contacts" table.
If you want to rename a database from "OldDatabase" to "NewDatabase", what command would you use?
0 Comments
Please do note create link post in comment section