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;
10. Write a conditional insert statement (10 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started