-
Notifications
You must be signed in to change notification settings - Fork 0
/
MySql.sql
45 lines (37 loc) · 1.1 KB
/
MySql.sql
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
create database Dentist ;
create table Doctor (
id int primary key auto_increment ,
name varchar(255) ,
username varchar(255) ,
password varchar(255),
national_id int ,
phone_number varchar(255),
Doctor_speciality varchar(255)
);
create table Patient (
id int primary key auto_increment ,
Patient_name varchar(255) ,
username varchar(255) ,
password varchar(255),
phone_number varchar(255),
age int ,
gender varchar(255)
);
create table Doctor_Patient (
id int primary key auto_increment ,
doctor_id int ,
patient_id int ,
status int ,
date date,
time time,
unique(patient_id,date,time),
unique(doctor_id,date,time),
unique(patient_id,doctor_id,date),
foreign key (doctor_id) references Doctor(id),
foreign key (patient_id) references Patient(id)
);
select * from Doctor ;
select * from Patient ;
select * from Doctor_Patient ;
insert into patient(Patient_name,username,password,phone_number,age,gender) values ('ayman','ayman','ayman123','1231231232132123',25,'male');
insert into doctor_patient (doctor_id,patient_id,status,date,time) values(1,1,0,'2023-01-14','08:00');