0
0
SQLquery~10 mins

DROP TABLE and ALTER TABLE in SQL - Interactive Code Practice

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

Complete the code to delete the table named 'employees'.

SQL
DROP TABLE [1];
Drag options to blanks, or click blank then click option'
Astaff
Bemployee
Cemployee_list
Demployees
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong table name that does not exist.
Forgetting to include the table name after DROP TABLE.
2fill in blank
medium

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

SQL
ALTER TABLE users [1] age INTEGER;
Drag options to blanks, or click blank then click option'
AADD COLUMN
BCHANGE COLUMN
CMODIFY COLUMN
DDROP COLUMN
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'DROP COLUMN' which removes a column instead of adding.
Using 'MODIFY COLUMN' which changes an existing column.
3fill in blank
hard

Fix the error in the code to remove the column 'salary' from the 'staff' table.

SQL
ALTER TABLE staff [1] salary;
Drag options to blanks, or click blank then click option'
AREMOVE COLUMN
BDROP COLUMN
CDELETE COLUMN
DERASE COLUMN
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'REMOVE COLUMN' which is not valid SQL.
Using 'DELETE COLUMN' which is incorrect syntax.
4fill in blank
hard

Fill both blanks to rename the table 'orders' to 'customer_orders'.

SQL
ALTER TABLE [1] [2] customer_orders;
Drag options to blanks, or click blank then click option'
Aorders
BRENAME TO
CCHANGE TO
Dorder_list
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'CHANGE TO' which is not standard SQL for renaming tables.
Swapping the order of table names.
5fill in blank
hard

Fill all three blanks to change the data type of the 'price' column in 'products' table to DECIMAL(10,2).

SQL
ALTER TABLE [1] [2] price [3] DECIMAL(10,2);
Drag options to blanks, or click blank then click option'
Aproducts
BMODIFY COLUMN
CSET DATA TYPE
DCHANGE COLUMN
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'MODIFY COLUMN' without 'SET DATA TYPE' which may not work in all SQL dialects.
Confusing 'DROP COLUMN' with changing data type.