Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

DDL Statements:

For table "employee"


CREATE TABLE employee(empID int NOT
NULL,empName varchar(100) NOT
NULL,counterNo int NOT NULL,constraint
pk_empID PRIMARY KEY (empID))
For table "patient"
CREATE TABLE patient(patientNo int NOT
NULL,PatientName varchar(100) NOT
NULL,age int,sex char,address
varchar(100),deposite currency NOT
NULL,regDate date,disDate date,remarks
text,empID int NOT NULL,CONSTRAINT
pk_patientNo PRIMARY KEY
(patientNo),CONSTRAINT fk_empID
FOREIGN KEY (empID) REFERENCES
employee (empID))

For table "doctor"


CREATE TABLE doctor(docID int NOT
NULL,docName varchar(100) NOT
NULL,address varchar(100),contact
varchar(30),faculty
varchar(100),CONSTRAINT pk_docID
PRIMARY KEY (docID))
For table "check"
CREATE TABLE check(docID int NOT
NULL,patientNo int NOT NULL,checkDate
date,fee currency,remarks
text,CONSTRAINT fk_docID FOREIGN KEY
(docID) REFERENCES doctor
(docID),CONSTRAINT fk1_patientNo
FOREIGN KEY (patientNo) REFERENCES
patient(patientNO))
For table "pharmacy"
CREATE TABLE pharmacy(patientNo int
NOT NULL ,buydate date NOT
NULL,particulars varchar(100),rate
currency,qty int,

amount currency,CONSTRATIN
ph_patientNo FOREIGN KEY (patientNo)
REFERENCES patient(patientNo))
For table "cafeteria"
CREATE TABLE cafeteria(patientNo int
NOT NULL,orderdate date NOT
NULL,particulars varchar(100),rate
currency,qty int,amount
currency,CONSTRAINT caf_patientNo
FOREIGN KEY (patientNo) REFERENCES
patient(patientNo),)
For table "test"
CREATE TABLE test(patientNo int NOT
NULL,testdate date,testhead
varchar(100),amount currency,remarks
text,CONSTRATIN test_patientNo
FOREIGN KEY (patientNo) REFERENCES
patient(patientNo))

You might also like