Complete the code to represent an entity as a table with its primary key.
CREATE TABLE [1] (ID INT PRIMARY KEY);In relational schema, an entity from an ER diagram is converted into a table named after the entity.
Complete the code to add a foreign key for a one-to-many relationship.
ALTER TABLE Orders ADD COLUMN [1] INT, ADD FOREIGN KEY ([1]) REFERENCES Customers(ID);
In a one-to-many relationship, the foreign key is added to the 'many' side table referencing the 'one' side primary key.
Fix the error in the relational schema for a many-to-many relationship.
CREATE TABLE [1] (StudentID INT, CourseID INT, PRIMARY KEY (StudentID, CourseID));Many-to-many relationships are represented by a new table (often called Enrollment) with foreign keys from both related entities.
Fill both blanks to create a table for a weak entity with a composite primary key.
CREATE TABLE [1] (OwnerID INT, [2] INT, PRIMARY KEY (OwnerID, [2]));
Weak entities require a composite key including the owner's key and their own partial key.
Fill all three blanks to define a table with an attribute and a foreign key for a multivalued attribute.
CREATE TABLE [1] (EntityID INT, [2] VARCHAR(100), PRIMARY KEY (EntityID, [2]), FOREIGN KEY (EntityID) REFERENCES [3](ID));
Multivalued attributes are represented by a separate table with a foreign key to the main entity and the attribute value.