Complete the SQL code to select all columns from the table named 'Employees'.
SELECT [1] FROM Employees;In SQL, * means select all columns from the table.
Complete the SQL code to create a table named 'Orders' with a primary key column 'OrderID'.
CREATE TABLE Orders (OrderID INT [1], OrderDate DATE);The PRIMARY KEY constraint uniquely identifies each record in the table.
Fix the error in the SQL code to remove partial dependencies and achieve 3NF by creating a new table for customer details.
CREATE TABLE Orders (OrderID INT PRIMARY KEY, CustomerID INT, [1] VARCHAR(100));
CustomerName depends on CustomerID, so it should be moved to a separate table to avoid partial dependency and achieve 3NF.
Fill both blanks to create a new table 'Customers' with CustomerID as primary key and CustomerName as a column.
CREATE TABLE Customers ([1] INT [2], CustomerName VARCHAR(100));
CustomerID is the column name and PRIMARY KEY defines it as the unique identifier for the Customers table.
Fill all three blanks to create a foreign key relationship from Orders to Customers on CustomerID.
ALTER TABLE Orders ADD CONSTRAINT [1] FOREIGN KEY ([2]) REFERENCES [3](CustomerID);
The constraint name is 'fk_customer', the foreign key column is 'CustomerID', and it references the 'Customers' table.