0
0
SQLquery~10 mins

Why table design matters in SQL - Test Your Understanding

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

Complete the code to select all columns from the employees table.

SQL
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
AALL
B*
Ceverything
Dcolumns
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*'
Writing column names when asked for all columns
2fill in blank
medium

Complete the code to create a table named customers with an id column as the primary key.

SQL
CREATE TABLE customers (id [1] PRIMARY KEY);
Drag options to blanks, or click blank then click option'
AINT
BVARCHAR(10)
CTEXT
DDATE
Attempts:
3 left
💡 Hint
Common Mistakes
Using TEXT or VARCHAR for primary key without reason
Choosing DATE type for an id
3fill in blank
hard

Fix the error in the code to add a new column named email of type VARCHAR(255) to the users table.

SQL
ALTER TABLE users [1] COLUMN email VARCHAR(255);
Drag options to blanks, or click blank then click option'
ACHANGE
BMODIFY
CADD
DUPDATE
Attempts:
3 left
💡 Hint
Common Mistakes
Using MODIFY or CHANGE which are for altering existing columns
Using UPDATE which is for data changes
4fill in blank
hard

Fill both blanks to create a table named orders with order_id as primary key and order_date as a date column.

SQL
CREATE TABLE orders (order_id [1] PRIMARY KEY, order_date [2]);
Drag options to blanks, or click blank then click option'
AINT
BVARCHAR(100)
CDATE
DTEXT
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR for order_date
Using TEXT for order_id
5fill in blank
hard

Fill all three blanks to select customer_name and order_date from orders where order_date is after 2023-01-01.

SQL
SELECT [1], [2] FROM orders WHERE [3] > '2023-01-01';
Drag options to blanks, or click blank then click option'
Acustomer_name
Border_date
Dcustomer_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using customer_id instead of customer_name
Filtering by wrong column in WHERE