-
Notifications
You must be signed in to change notification settings - Fork 2
/
blood_bank.sql
237 lines (198 loc) · 7.56 KB
/
blood_bank.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 18, 2019 at 04:43 AM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `blood_bank`
--
-- --------------------------------------------------------
--
-- Table structure for table `donor`
--
CREATE TABLE `donor` (
`uId` int(7) NOT NULL,
`fname` varchar(255) NOT NULL,
`lname` varchar(255) NOT NULL,
`age` int(10) NOT NULL,
`sex` varchar(255) NOT NULL,
`blood_group` varchar(20) NOT NULL,
`phone` varchar(20) NOT NULL,
`dob` date NOT NULL,
`city` varchar(255) NOT NULL,
`state` varchar(100) NOT NULL,
`about` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `donor`
--
INSERT INTO `donor` (`uId`, `fname`, `lname`, `age`, `sex`, `blood_group`, `phone`, `dob`, `city`, `state`, `about`) VALUES
(1, 'Hasibul Alam', 'Ratul', 25, 'Male', 'O-', '01730482775', '1994-09-16', 'Dhaka', 'Yes', 'Calm'),
(2, 'Ishrat', 'Diya', 24, 'Female', 'B+', '01686660052', '1995-04-16', 'Dhaka', 'No', 'Keep calm and donate blood'),
(3, 'Ramiza', 'Maliha', 24, 'Female', 'O+', '01837542987', '1996-10-14', 'Chittagong', 'Yes', 'Carpe Diem!'),
(4, 'Sadia', 'Sheikh', 23, 'Female', 'A+', '01554876254', '1997-06-14', 'Dhaka', 'No', 'Need blood? contact me'),
(5, 'Mahira', 'Jalisha', 22, 'Female', 'O+', '01843927943', '1998-02-28', 'Dhaka', 'Yes', 'wonderer who is Wondering about the wondering world'),
(6, 'Nahid', 'Ontu', 24, 'Male', 'B+', '01676800456', '1996-06-25', 'Dhaka', 'Yes', 'Life has so many stories to tell'),
(7, 'Faria', 'Islam', 24, 'Female', 'A+', '01554697826', '1995-09-22', 'Khulna', 'No', 'No Comments'),
(8, 'Tahmid', 'Abrar', 26, 'Male', 'AB+', '01478596235', '1993-12-06', 'Rajshahi', 'No', 'I had a dream');
--
-- Triggers `donor`
--
DELIMITER $$
CREATE TRIGGER `donor_backup` BEFORE INSERT ON `donor` FOR EACH ROW INSERT INTO donor_backup VALUES (NEW.uId,NEW.fname,NEW.lname,NEW.age,NEW.sex,NEW.blood_group,NEW.phone,NEW.dob,NEW.city,NEW.state,NEW.about)
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `donor_delete` BEFORE DELETE ON `donor` FOR EACH ROW BEGIN
INSERT INTO donor_delete
VALUES (old.uId,old.fname,old.lname,old.age,old.sex,old.blood_group,old.phone,old.dob,old.city,old.state,old.about);
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `donor_backup`
--
CREATE TABLE `donor_backup` (
`uId` int(7) NOT NULL,
`fname` varchar(255) NOT NULL,
`lname` varchar(255) NOT NULL,
`age` int(10) NOT NULL,
`sex` varchar(255) NOT NULL,
`blood_group` varchar(20) NOT NULL,
`phone` varchar(20) NOT NULL,
`dob` date DEFAULT NULL,
`city` varchar(255) NOT NULL,
`state` varchar(100) NOT NULL,
`about` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `donor_backup`
--
INSERT INTO `donor_backup` (`uId`, `fname`, `lname`, `age`, `sex`, `blood_group`, `phone`, `dob`, `city`, `state`, `about`) VALUES
(2, 'Ishrat', 'Diya', 24, 'Female', 'B+', '1686660052', '0000-00-00', 'Dhaka', 'No', 'Keep calm and donate blood'),
(3, 'Ramiza', 'Maliha', 24, 'Female', 'O+', '1837542987', '0000-00-00', 'Chittagong', 'Yes', 'Carpe Diem!'),
(4, 'Sadia', 'Sheikh', 23, 'Female', 'A+', '1554876254', '0000-00-00', 'Dhaka', 'No', 'Need blood? contact me'),
(5, 'Mahira', 'Jalisha', 22, 'Female', 'O+', '1843927943', '0000-00-00', 'Dhaka', 'Yes', 'wonderer who is Wondering about the wondering world'),
(6, 'Nahid', 'Ontu', 24, 'Male', 'B+', '1676800456', '0000-00-00', 'Dhaka', 'No', 'Life has so many stories to tell'),
(7, 'Faria', 'Islam', 24, 'Female', 'A+', '1554697826', '0000-00-00', 'Kushtia', 'No', 'No Comments'),
(8, 'Tahmid', 'Abrar', 26, 'Male', 'AB+', '1478596235', '0000-00-00', 'Joypurhat', 'No', 'I had a dream'),
(0, 'Naruto', 'Uzumaki', 26, 'Male', '', '01552646799', '1994-10-13', 'Chittagong', 'Yes', 'DATTEBAYOOOOO!!!!');
-- --------------------------------------------------------
--
-- Table structure for table `donor_delete`
--
CREATE TABLE `donor_delete` (
`uId` int(7) NOT NULL,
`fname` varchar(255) NOT NULL,
`lname` varchar(255) NOT NULL,
`age` int(10) NOT NULL,
`sex` varchar(255) NOT NULL,
`blood_group` varchar(20) NOT NULL,
`phone` varchar(20) NOT NULL,
`dob` date DEFAULT NULL,
`city` varchar(255) NOT NULL,
`state` varchar(100) NOT NULL,
`about` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `donor_delete`
--
INSERT INTO `donor_delete` (`uId`, `fname`, `lname`, `age`, `sex`, `blood_group`, `phone`, `dob`, `city`, `state`, `about`) VALUES
(9, 'Naruto', 'Uzumaki', 26, 'Male', '', '01552646799', '1994-10-13', 'Chittagong', 'Yes', 'DATTEBAYOOOOO!!!!');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`ID` int(7) NOT NULL,
`uId` int(7) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`ID`, `uId`, `email`, `password`) VALUES
(1, 1, 'hasib.ratul@nsu.edu', 'Calmhasib25'),
(2, 2, 'ishrat.diya94@nsu.edu', '#moradiya'),
(3, 3, 'ramiza.malihahehehehe@nsu.edu', '#ramizoro1423'),
(4, 4, 'sadia.sheikh@nsu.edu', 'armin7'),
(5, 5, 'mahira.jalishalol@nsu.edu', 'BakaNeko'),
(6, 6, 'nahid.ontu299nsu.edu', 'barishaillanahid'),
(7, 7, 'faria.punni@gmail.com', 'punni94'),
(8, 8, 'tahmid_tousif@gmail.com', 'fisout'),
(9, 0, 'n_uzumaki@gmail.com', 'narutooo');
-- --------------------------------------------------------
--
-- Table structure for table `post`
--
CREATE TABLE `post` (
`P_id` int(5) NOT NULL,
`Blood_G` varchar(20) NOT NULL,
`Name` varchar(25) NOT NULL,
`phone` varchar(20) NOT NULL,
`city` varchar(255) NOT NULL,
`urgency` varchar(100) NOT NULL,
`S_Remark` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `post`
--
INSERT INTO `post` (`P_id`, `Blood_G`, `Name`, `phone`, `city`, `urgency`, `S_Remark`) VALUES
(1, 'O+', 'Bomkesh Bokshi', '01975684264', 'Dhaka', 'ASAP', 'Needs in 2 days.'),
(2, 'A+', 'Robert Langdon', '01574598354', 'Dhaka', 'NO', 'Needed for an open heart surgery on. Due: 01/01/2020'),
(3, 'O-', 'Anondo Kor', '01235489753', 'Khulna', 'NO', 'The patient is now ok.');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `donor`
--
ALTER TABLE `donor`
ADD PRIMARY KEY (`uId`);
--
-- Indexes for table `login`
--
ALTER TABLE `login`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `ID` (`ID`),
ADD UNIQUE KEY `email` (`email`,`password`);
--
-- Indexes for table `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`P_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `donor`
--
ALTER TABLE `donor`
MODIFY `uId` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `login`
--
ALTER TABLE `login`
MODIFY `ID` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `post`
--
ALTER TABLE `post`
MODIFY `P_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;