-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase_user_passwords.sql
executable file
·57 lines (44 loc) · 1.68 KB
/
database_user_passwords.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
45
46
47
48
49
50
51
52
53
54
55
56
57
CREATE TABLE IF NOT EXISTS `user_doctor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
INSERT INTO user_doctor
(id , username , password , email )
SELECT doctorID , REPLACE(CONCAT(LOWER(first_name) ,'.', LOWER(last_name)) , ' ', '') , telephone_number , email
FROM doctor;
CREATE TABLE IF NOT EXISTS `user_patient` (
`id` varchar(11) NOT NULL ,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO user_patient
(id , username , password , email )
SELECT SSN , REPLACE(CONCAT(LOWER(first_name) ,'.', LOWER(last_name)) , ' ', '') , telephone_number , email
FROM patient;
CREATE TABLE IF NOT EXISTS `user_company` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
INSERT INTO user_company
(id , username , password , email )
SELECT companyID , LOWER(name) , telephone_number , email
FROM company;
CREATE TABLE IF NOT EXISTS `user_pharmacy` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`website` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
INSERT INTO user_pharmacy
(id , username , password , website )
SELECT TIN , CONCAT(TIN ,'.', number ) , telephone_number , website
FROM pharmacy;