Quiz Yourself: Querying Multiple Tables
Test your knowledge of relationships and the types of joins.
Querying Multiple Tables Quiz
1
Consider the following query:
CREATE TABLE Customers
(
Id INT PRIMARY KEY IDENTITY(1, 1),
Name NVARCHAR(100) NOT NULL,
Email NVARCHAR(100) NOT NULL
);
CREATE TABLE Items
(
Id INT PRIMARY KEY IDENTITY(1, 1),
Title NVARCHAR(100) NOT NULL,
Description NVARCHAR(100) NULL,
Price NUMERIC(18, 2)
);
CREATE TABLE Orders
(
ItemId INT REFERENCES Items (Id),
CustomerId INT REFERENCES Customers (Id),
OrderDate DATETIME NOT NULL,
PRIMARY KEY (ItemId, CustomerId, OrderDate)
);
(Select all that apply.) Which option(s) are foreign keys?
A)
Items.Id
B)
Orders.ItemsId
C)
Orders.CustomerId
D)
Customers.Id
Question 1 of 50 attempted
Get hands-on with 1400+ tech skills courses.