-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtable.txt
More file actions
29 lines (27 loc) · 863 Bytes
/
table.txt
File metadata and controls
29 lines (27 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
CREATE TABLE patients (
id INT DEFAULT patient_id_seq.NEXTVAL PRIMARY KEY,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
date_of_birth DATE NOT NULL,
gender VARCHAR(10) NOT NULL,
age INT NOT NULL,
contact_number VARCHAR(20) NOT NULL,
address TEXT NOT NULL,
blood_group VARCHAR(5)
);
CREATE TABLE doctor (
id INT DEFAULT doctor_id_seq.NEXTVAL PRIMARY KEY,
name VARCHAR(50) NOT NULL,
nic VARCHAR(15) NOT NULL,
specialize VARCHAR(100) NOT NULL
);
CREATE TABLE appointment_details (
id INT DEFAULT appointment_id_seq.NEXTVAL PRIMARY KEY,
patient_id INT NOT NULL,
doctor_id INT NOT NULL,
date VARCHAR(10) NOT NULL,
time VARCHAR(30) NOT NULL,
description VARCHAR(255) NOT NULL,
FOREIGN KEY (patient_id) REFERENCES patients(id),
FOREIGN KEY (doctor_id) REFERENCES doctor(id)
);