0
0
MySQLquery~10 mins

ALTER TABLE operations in MySQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a new column named 'age' of type INT to the 'users' table.

MySQL
ALTER TABLE users [1] COLUMN age INT;
Drag options to blanks, or click blank then click option'
AMODIFY
BDROP
CADD
DRENAME
Attempts:
3 left
💡 Hint
Common Mistakes
Using DROP instead of ADD removes a column.
MODIFY changes a column but does not add one.
RENAME changes the table or column name, not adding columns.
2fill in blank
medium

Complete the code to remove the column 'age' from the 'users' table.

MySQL
ALTER TABLE users [1] COLUMN age;
Drag options to blanks, or click blank then click option'
ACHANGE
BMODIFY
CADD
DDROP
Attempts:
3 left
💡 Hint
Common Mistakes
Using ADD instead of DROP adds a column instead of removing it.
MODIFY changes column type but does not remove it.
CHANGE renames a column but does not remove it.
3fill in blank
hard

Fix the error in the code to change the data type of the 'age' column to VARCHAR(3).

MySQL
ALTER TABLE users [1] age VARCHAR(3);
Drag options to blanks, or click blank then click option'
AMODIFY
BRENAME
CADD
DDROP
Attempts:
3 left
💡 Hint
Common Mistakes
Using ADD tries to add a new column instead of changing existing one.
DROP removes the column instead of changing it.
RENAME changes the column name, not its type.
4fill in blank
hard

Fill in the blank to rename the column 'age' to 'user_age' in the 'users' table.

MySQL
ALTER TABLE users [1] age user_age VARCHAR(3);
Drag options to blanks, or click blank then click option'
AMODIFY
BCHANGE
CADD
DDROP
Attempts:
3 left
💡 Hint
Common Mistakes
Using MODIFY only changes type, not the name.
ADD adds a new column, does not rename.
DROP removes the column instead of renaming.
5fill in blank
hard

Fill all three blanks to add a new column 'email' of type VARCHAR(255) after the 'user_age' column.

MySQL
ALTER TABLE users [1] COLUMN email VARCHAR(255) [2] [3] user_age;
Drag options to blanks, or click blank then click option'
AADD
BAFTER
CNOT NULL
DDROP
Attempts:
3 left
💡 Hint
Common Mistakes
Using DROP instead of ADD removes columns.
Forgetting NOT NULL allows NULL values.
Placing AFTER before the type causes syntax errors.