0
0
SQLquery~10 mins

CREATE TABLE syntax 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 create a table named 'students'.

SQL
CREATE TABLE [1] (id INT, name VARCHAR(50));
Drag options to blanks, or click blank then click option'
Astudent
Bstudents
Cstudent_table
DstudentList
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form 'student' instead of 'students'.
Adding extra words or underscores in the table name.
2fill in blank
medium

Complete 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'
AINT
BTEXT
CVARCHAR
DCHAR
Attempts:
3 left
💡 Hint
Common Mistakes
Using INT which is for numbers.
Using TEXT which usually has no length limit.
3fill in blank
hard

Fix 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'
ANOT NULL
BUNIQUE
CAUTO_INCREMENT
DDEFAULT
Attempts:
3 left
💡 Hint
Common Mistakes
Using AUTO_INCREMENT without NOT NULL.
Using UNIQUE alone does not guarantee NOT NULL.
4fill in blank
hard

Fill 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'
AINT
BVARCHAR(20)
CDATE
DTEXT
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR for order_id or order_date.
Using TEXT for date columns.
5fill in blank
hard

Fill 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'
AINT
BNOT NULL
CVARCHAR(100)
DTEXT
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting NOT NULL for primary key.
Using TEXT instead of VARCHAR for name.