0
0
MySQLquery~10 mins

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

MySQL
CREATE TABLE [1] (id INT, name VARCHAR(50));
Drag options to blanks, or click blank then click option'
Astudents
BstudentList
Cstudent_table
Dstudent
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 'age' as an integer.

MySQL
CREATE TABLE people (name VARCHAR(100), age [1]);
Drag options to blanks, or click blank then click option'
ADATE
BVARCHAR(3)
CTEXT
DINT
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'TEXT' or 'VARCHAR' for numeric data.
Using 'DATE' which is for dates, not numbers.
3fill in blank
hard

Fix the error in the column definition for 'email' to allow text up to 255 characters.

MySQL
CREATE TABLE contacts (email [1](255));
Drag options to blanks, or click blank then click option'
AINT
BVARCHAR
CTEXT
DCHAR
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'INT' which is for numbers.
Using 'TEXT' without length specification.
Using 'CHAR' which is fixed length.
4fill in blank
hard

Fill both blanks to create a table 'orders' with a primary key 'order_id' that auto-increments.

MySQL
CREATE TABLE orders (order_id [1] [2] PRIMARY KEY, order_date DATE);
Drag options to blanks, or click blank then click option'
AINT
BPRIMARY KEY
CAUTO_INCREMENT
DVARCHAR(20)
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR for an ID that should be numeric.
Forgetting to add AUTO_INCREMENT for unique IDs.
5fill in blank
hard

Fill all three blanks to create a table 'employees' with 'id' as primary key, 'name' as text, and 'salary' as decimal with 10 digits and 2 decimals.

MySQL
CREATE TABLE employees (id [1] [2], name [3], salary DECIMAL(10,2));
Drag options to blanks, or click blank then click option'
AINT
BPRIMARY KEY
CVARCHAR(100)
DTEXT
Attempts:
3 left
💡 Hint
Common Mistakes
Using TEXT for 'name' which is less efficient than VARCHAR here.
Not marking 'id' as PRIMARY KEY.