Question: 1.Please create related three tables about a subjects (for exp. Students, Employees, Products, Books, Club_Membership, Hobbies etc.) must contain at least a default value definition

1.Please create related three tables about a subjects (for exp. Students, Employees, Products, Books, Club_Membership, Hobbies etc.) must contain at least a default value definition and a primary key, a foreign key,unique,not null and check constraints.

Persons Table -

CREATE TABLE Persons ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int CHECK (Age>=18), City varchar(255) DEFAULT 'Earth', PRIMARY KEY(ID) );

Orders Table

CREATE TABLE Orders ( OrderID int NOT NULL, PersonID int, PRIMARY KEY (OrderID), FOREIGN KEY (PersonID) REFERENCES Persons(ID) );

Resturants Table -

CREATE TABLE Resturants ( ID int NOT NULL, Name varchar(255) NOT NULL, Order_ID int, FOREIGN KEY (Order_ID) REFERENCES Orders(OrderID), UNIQUE (ID) );

these are the tables and below are the questions; 3.Create a non-unique index on each table for a non-uqiue column. (10 points) Write SQL commands below:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!