Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a table named 'students'.
SQL
CREATE TABLE [1] (id INT, name VARCHAR(50));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form 'student' instead of 'students'.
Adding extra words or underscores in the table name.
✗ Incorrect
The table name should be 'students' as specified.
2fill in blank
mediumComplete the code to define a column for storing text up to 100 characters.
SQL
CREATE TABLE books (title [1](100));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using INT which is for numbers.
Using TEXT which usually has no length limit.
✗ Incorrect
VARCHAR(100) defines a variable-length string column with max 100 characters.
3fill in blank
hardFix the error in the code to correctly create a table with a primary key.
SQL
CREATE TABLE employees (id INT [1] PRIMARY KEY, name VARCHAR(50));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using AUTO_INCREMENT without NOT NULL.
Using UNIQUE alone does not guarantee NOT NULL.
✗ Incorrect
Primary key columns must be NOT NULL to ensure uniqueness.
4fill in blank
hardFill both blanks to create a table with an integer ID and a date column.
SQL
CREATE TABLE orders (order_id [1], order_date [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR for order_id or order_date.
Using TEXT for date columns.
✗ Incorrect
order_id should be INT and order_date should be DATE type.
5fill in blank
hardFill all three blanks to create a table with a primary key, a name, and a salary column.
SQL
CREATE TABLE staff (staff_id [1] [2] PRIMARY KEY, name [3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting NOT NULL for primary key.
Using TEXT instead of VARCHAR for name.
✗ Incorrect
staff_id is INT NOT NULL PRIMARY KEY, name is VARCHAR(100) for text.