-
Notifications
You must be signed in to change notification settings - Fork 0
/
blood_SQL.txt
108 lines (62 loc) · 1.84 KB
/
blood_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
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
create database BloodManagement;
use BloodManagement;
CREATE TABLE bloodDonorTable(
`Id` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(30) NOT NULL,
`Gender` VARCHAR(10) NOT NULL,
`Address` VARCHAR (50) NOT NULL,
`Date` Date NOT NULL,
`BloodGroup` VARCHAR (10) NOT NULL,
`EID` VARCHAR (50) NOT NULL,
`QTY` Int NOT NULL,
`Amount` Double NOT NULL,
PRIMARY KEY (`Id`));
CREATE TABLE EMPTable(
`Id` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(30) NOT NULL,
`EID` Int NOT NULL,
`CONTACT` VARCHAR (30) NOT NULL,
Key (EID),
PRIMARY KEY (`Id`));
CREATE TABLE `RECIEVERTable` (
`Id` INT NOT NULL AUTO_INCREMENT,
`Date` Date NOT NULL,
`Name` VARCHAR (35) NOT NULL,
`BloodGroup` VARCHAR (10) NOT NULL,
`Gender` VARCHAR(10) NOT NULL,
`Contact` VARCHAR(15) NOT NULL,
`DoctorName` VARCHAR(30) NOT NULL,
`EID` Int NOT NULL,
`AMount` INT NOT NULL,
`QTY` INT NOT NULL,
Key(EID),
PRIMARY KEY (`Id`),
INDEX par_Tind (EId),
CONSTRAINT fk_employee FOREIGN KEY (Eid)
REFERENCES EMPTable (EId)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=INNODB;
CREATE TABLE DoctorTable(
`Id` INT NOT NULL AUTO_INCREMENT,
`Name` VARCHAR (30) NOT NULL,
`CONTACT` VARCHAR (30) NOT NULL,
`Address` VARCHAR(200),
PRIMARY KEY (`Id`));
CREATE TABLE InventoryTable(
`Id` INT NOT NULL AUTO_INCREMENT,
`BloodGroup` VARCHAR (30) NOT NULL,
`Qty` int NOT NULL,
PRIMARY KEY (`Id`));
CREATE TABLE TransactionTable(
`Id` INT NOT NULL AUTO_INCREMENT,
`Amount` INT NOT NULL,
`EName` VARCHAR(30) NOT NULL,
`Description` VARCHAR(200) NOT NULL,
`TYP`VARCHAR(30) NOT NULL,
PRIMARY KEY (`Id`));
// truncate table which has foreign key contraints.
SET FOREIGN_KEY_CHECKS = 0;
truncate tableName;
SET FOREIGN_KEY_CHECKS = 1;
// done.