Question: I need someone to convert this sql code to relational Schema DROP TABLE IF EXISITS Person CREATE TABLE Persons ( Per_Id INT NOT NULL, Address
I need someone to convert this sql code to relational Schema
DROP TABLE IF EXISITS Person CREATE TABLE Persons ( Per_Id INT NOT NULL, Address INT NOT NULL, name INT NOT NULL, City INT NOT NULL, BDate INT NOT NULL, Phone INT NOT NULL, PRIMARY KEY (Per_Id) );
CREATE TABLE Physicians_ ( Specialty_ INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES Persons(Per_Id) );
CREATE TABLE Pateint ( date INT NOT NULL, Pager# INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES Persons(Per_Id) );
CREATE TABLE Volunteer ( Skills INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES Persons(Per_Id) );
CREATE TABLE Out-patient ( Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES Pateint(Per_Id) );
CREATE TABLE In-patient ( Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES Pateint(Per_Id) );
CREATE TABLE visit ( Date INT NOT NULL, Num INT NOT NULL, Comments INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Num), FOREIGN KEY (Per_Id) REFERENCES Out-patient(Per_Id) );
CREATE TABLE employee ( Date_Hired INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES Persons(Per_Id) );
CREATE TABLE staff ( Job INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES employee(Per_Id) );
CREATE TABLE Nurse ( Certificate INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES employee(Per_Id) );
CREATE TABLE Technician ( Skills INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Per_Id), FOREIGN KEY (Per_Id) REFERENCES employee(Per_Id) );
CREATE TABLE Laboratories ( Name INT NOT NULL, location INT NOT NULL, Per_Id INT NOT NULL, PRIMARY KEY (Name), FOREIGN KEY (Per_Id) REFERENCES Technician(Per_Id) );
CREATE TABLE Care_Center ( type INT NOT NULL, location INT NOT NULL, PRIMARY KEY (type) );
CREATE TABLE Beds ( Room# INT NOT NULL, BED_ID INT NOT NULL, Bed# INT NOT NULL, type INT NOT NULL, PRIMARY KEY (BED_ID), FOREIGN KEY (type) REFERENCES Care_Center(type), UNIQUE (Room#), UNIQUE (Bed#) );
CREATE TABLE Assign ( Per_Id INT NOT NULL, BED_ID INT NOT NULL, PRIMARY KEY (Per_Id, BED_ID), FOREIGN KEY (Per_Id) REFERENCES In-patient(Per_Id), FOREIGN KEY (BED_ID) REFERENCES Beds(BED_ID) );
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
