Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please can some one help correct errors in this Sql Scripts CREATE TABLE PatientAssignment ( PatientNum INT NOT NULL , PatientFName VARCHAR(50), PatientLName VARCHAR (50)

Please can some one help correct errors in this Sql Scripts


CREATE TABLE PatientAssignment (

PatientNum INT NOT NULL ,

PatientFName VARCHAR(50),

PatientLName VARCHAR (50) ,

WardNum INT NOT NULL ,

-- primary key

CONSTRAINT PK_PatientAssignment Primary Key(PatientNum , WardNum) ,

-- foreign key

CONSTRAINT FK_PatientAssignment FOREIGN KEY (PatientNum) REFERENCES PatientRegistrationInfo (PatientNum)

);

-- creation of table Ward

CREATE TABLE Ward (

WardNum INT NOT NULL PRIMARY KEY,

WardName VARCHAR(50),

BedNum VARCHAR (50) ,

WardLoc VARCHAR (50),

TeleExt VARCHAR (50),

);

-- creation of table Appointment

CREATE TABLE Appointment (

ApptNum INT NOT NULL Primary Key ,

ApptDate date,

ApptTime TIME ,

PatientNum VARCHAR (50),

StaffNum INT NOT NULL

-- foreign key

CONSTRAINT FK_Appointment FOREIGN KEY ( StaffNum ) REFERENCES Staff (StaffNum)

);

-- creation of table ExamRoomAppt

CREATE TABLE ExamRoomAppt (

ApptNum INT NOT NULL ,

ApptExamRoomNum INT NOT NULL,

ApptExamRoomName VARCHAR (50) ,

PatientNum INT NOT NULL ,

-- foreign key

CONSTRAINT FK_ExamRoomAppt FOREIGN KEY ( ApptNum ) REFERENCES Appointment (ApptNum) ,

CONSTRAINT FK_Patient FOREIGN KEY ( PatientNum ) REFERENCES PatientRegistrationInfo (PatientNum) ,

-- primary key

CONSTRAINT PK_ExamRoomAppt Primary Key(PatientNum , ApptNum)

);

-- creation of table PatientMedication

CREATE TABLE PatientMedication (

PatientNum INT NOT NULL ,

PatientFName VARCHAR(50),

PatientLName VARCHAR (50) ,

SupplyNum INT NOT NULL , SupplyName VARCHAR (50),

CONSTRAINT PK_PatientMedication Primary Key(PatientNum , SupplyNum) ,

-- foreign key

CONSTRAINT FK_PatientMedication FOREIGN KEY (PatientNum) REFERENCES PatientRegistrationInfo (PatientNum) ,

-- foreign key

CONSTRAINT FK_Supply FOREIGN KEY (SupplyNum) REFERENCES Supply (SupplyNum)

);

-- creation of table Bed

CREATE TABLE Bed(

PatientNumber INT NOT NULL ,

PatientFName VARCHAR( 50),

PatientLName VARCHAR (50),

BedNum VARCHAR (50),

BedName VARCHAR (50),

PaDatePlaced date,

PaStay Numeric(18, 0),

PaDateExpLeave date ,

PaDateActDepart date ,

);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Modeling and Database Design

Authors: Narayan S. Umanath, Richard W. Scammel

2nd edition

1285085256, 978-1285085258

Students also viewed these Databases questions