-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsql.txt
34 lines (31 loc) · 1.49 KB
/
sql.txt
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
Table 1:CREATE TABLE Hospital_details (
hospital_id INT not null AUTO_INCREMENT,
hospital_name VARCHAR(255) not null,
hospital_long VARCHAR(255) not null,
hospital_lat VARCHAR(255) not null,
username VARCHAR(255) not null,
pass VARCHAR(255) not null,
option_selected INT not null,
PRIMARY KEY(hospital_id)
);
Table 2:
create table Hospital_option_a(`ip_add` varchar(255) not null,`dbname` varchar(255) not null,`tablename` varchar(255) not null,`fiel_name_tot_bed` varchar(255) not null,`username` VARCHAR(255) not null UNIQUE, `pass` VARCHAR(255) not null,`fiel_name_unoc_bed` varchar(255) not null,`hospital_ref` int not null,FOREIGN KEY (`hospital_ref`) REFERENCES Hospital_details(hospital_id));
Table 3:
CREATE TABLE `bed_trcker`.`option_b` (`tot_bed` INT NOT NULL ,`unocc_bed` INT NOT NULL,`hosp_id` int not null,FOREIGN KEY (hosp_id) REFERENCES Hospital_details(hospital_id)) ENGINE = InnoDB;
Table 4:
CREATE TABLE user_details (
user_id int not null AUTO_INCREMENT,
user_name varchar(255) not null UNIQUE,
email varchar(255) not null UNIQUE,
pass varchar(255) not null,
PRIMARY KEY(user_id)
);
Table 5:
CREATE TABLE rating (
user_id int not null ,
hospital_id int not null,
rating int not null,
CONSTRAINT FOREIGN key (user_id) REFERENCES user_details(user_id) on DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT FOREIGN key (hospital_id) REFERENCES hospital_detail(hospital_id) on DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (user_id,hospital_id)
);