0
0
SQLquery~10 mins

Third Normal Form (3NF) in SQL - Interactive Code Practice

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

Complete the SQL code to select all columns from the table named 'Employees'.

SQL
SELECT [1] FROM Employees;
Drag options to blanks, or click blank then click option'
A*
BALL
CALL_COLUMNS
DEVERYTHING
Attempts:
3 left
💡 Hint
Common Mistakes
Using keywords like ALL or ALL_COLUMNS which are not valid in SELECT.
Trying to write column names when you want all columns.
2fill in blank
medium

Complete the SQL code to create a table named 'Orders' with a primary key column 'OrderID'.

SQL
CREATE TABLE Orders (OrderID INT [1], OrderDate DATE);
Drag options to blanks, or click blank then click option'
AUNIQUE
BINDEX
CFOREIGN KEY
DPRIMARY KEY
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNIQUE instead of PRIMARY KEY, which is similar but not the main key.
Confusing FOREIGN KEY with PRIMARY KEY.
3fill in blank
hard

Fix the error in the SQL code to remove partial dependencies and achieve 3NF by creating a new table for customer details.

SQL
CREATE TABLE Orders (OrderID INT PRIMARY KEY, CustomerID INT, [1] VARCHAR(100));
Drag options to blanks, or click blank then click option'
AOrderDate
BCustomerName
CProductID
DOrderAmount
Attempts:
3 left
💡 Hint
Common Mistakes
Keeping CustomerName in Orders table causing partial dependency.
Removing columns unrelated to customer details.
4fill in blank
hard

Fill both blanks to create a new table 'Customers' with CustomerID as primary key and CustomerName as a column.

SQL
CREATE TABLE Customers ([1] INT [2], CustomerName VARCHAR(100));
Drag options to blanks, or click blank then click option'
ACustomerID
BPRIMARY KEY
CFOREIGN KEY
DUNIQUE
Attempts:
3 left
💡 Hint
Common Mistakes
Using FOREIGN KEY instead of PRIMARY KEY here.
Using UNIQUE without PRIMARY KEY for the main identifier.
5fill in blank
hard

Fill all three blanks to create a foreign key relationship from Orders to Customers on CustomerID.

SQL
ALTER TABLE Orders ADD CONSTRAINT [1] FOREIGN KEY ([2]) REFERENCES [3](CustomerID);
Drag options to blanks, or click blank then click option'
Afk_customer
BCustomerID
CCustomers
DOrderID
Attempts:
3 left
💡 Hint
Common Mistakes
Using OrderID instead of CustomerID as foreign key.
Referencing wrong table name in REFERENCES clause.