-
Notifications
You must be signed in to change notification settings - Fork 0
/
BookBank_2016-12-02.sql
162 lines (129 loc) · 6.16 KB
/
BookBank_2016-12-02.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
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.7.10)
# Database: BookBank
# Generation Time: 2016-12-02 15:08:26 +0000
# ************************************************************
/*!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 utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table Bill
# ------------------------------------------------------------
DROP TABLE IF EXISTS `Bill`;
CREATE TABLE `Bill` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dateOfBilling` varchar(50) DEFAULT NULL,
`member_id` int(11) NOT NULL,
`transaction_id` int(11) NOT NULL,
`amount` int(11) DEFAULT NULL,
`paid` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `transaction_id` (`transaction_id`),
CONSTRAINT `bill_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `Member` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `bill_ibfk_2` FOREIGN KEY (`transaction_id`) REFERENCES `Transaction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
LOCK TABLES `Bill` WRITE;
/*!40000 ALTER TABLE `Bill` DISABLE KEYS */;
INSERT INTO `Bill` (`id`, `dateOfBilling`, `member_id`, `transaction_id`, `amount`, `paid`)
VALUES
(4,'Wed Nov 30 18:14:20 EST 2016',8,11,10,0);
/*!40000 ALTER TABLE `Bill` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table Book
# ------------------------------------------------------------
DROP TABLE IF EXISTS `Book`;
CREATE TABLE `Book` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) DEFAULT NULL,
`author` varchar(50) DEFAULT NULL,
`status` enum('available','unavailable') DEFAULT NULL,
`genre` enum('science fiction','satire','drama','action and adventure','romance','mystery','horror','travel','kids','history','math','comic','cookbook','biography','autobiography','health','religion and spiritual','encyclopedia','dictionary') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
LOCK TABLES `Book` WRITE;
/*!40000 ALTER TABLE `Book` DISABLE KEYS */;
INSERT INTO `Book` (`id`, `title`, `author`, `status`, `genre`)
VALUES
(1,'The Alchemist','Paulo Coelho','available','drama'),
(2,'The Girl on the train','Paula Hawkins','available','romance'),
(3,'In a Dark, Dark Wood','Ruth Ware','available','horror'),
(4,'Eat Happy','Anna Vocino','available','cookbook'),
(5,'The Perfume Collector','Kathleen Tessaro','available','romance'),
(6,'Dune','Frank Herbert','available','science fiction'),
(7,'Animal Farm','George Orwell','available','satire'),
(8,'The call of the Wild','Jack London','available','action and adventure'),
(9,'Gone Girl','Gillian Flynn','available','mystery'),
(10,'The Great Railway Bazaar','Paul Theroux','available','travel'),
(11,'Goodnight Moon','Margaret Wise','available','kids'),
(12,'The guns of August','Barabara Tuchman','available','history'),
(13,'Journey thriugh Genius','William Dunham','available','math'),
(14,'BAtman: The killing joke','Alan Moore','available','comic');
/*!40000 ALTER TABLE `Book` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table Member
# ------------------------------------------------------------
DROP TABLE IF EXISTS `Member`;
CREATE TABLE `Member` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
LOCK TABLES `Member` WRITE;
/*!40000 ALTER TABLE `Member` DISABLE KEYS */;
INSERT INTO `Member` (`id`, `firstname`, `lastname`, `address`, `email`, `username`, `password`)
VALUES
(1,'Alice','Wonderland','USA','[email protected]','alice','alice'),
(3,'Dhruv','Upadhyay','NH','[email protected]','dhruv','dhruv'),
(4,'Bob','Waltz','DC','[email protected]','bob','bob'),
(7,'Charlie','Brown','SFO','[email protected]','charlie','charlie'),
(8,'Kreena','Mehta','Boston','[email protected]','kreena','kreena');
/*!40000 ALTER TABLE `Member` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table Transaction
# ------------------------------------------------------------
DROP TABLE IF EXISTS `Transaction`;
CREATE TABLE `Transaction` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL,
`book_id` int(11) NOT NULL,
`dateOfIssue` varchar(50) DEFAULT NULL,
`dateOfReturn` varchar(50) DEFAULT NULL,
`bookReturned` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`),
KEY `book_id` (`book_id`),
CONSTRAINT `transaction_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `Member` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `transaction_ibfk_2` FOREIGN KEY (`book_id`) REFERENCES `Book` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
LOCK TABLES `Transaction` WRITE;
/*!40000 ALTER TABLE `Transaction` DISABLE KEYS */;
INSERT INTO `Transaction` (`id`, `member_id`, `book_id`, `dateOfIssue`, `dateOfReturn`, `bookReturned`)
VALUES
(10,8,2,'Wed Nov 30 18:11:50 EST 2016','Wed Nov 30 18:12:50 EST 2016',1),
(11,8,4,'Wed Nov 30 18:13:07 EST 2016','Wed Nov 30 18:14:07 EST 2016',1),
(12,8,4,'Fri Dec 02 09:22:37 EST 2016','Fri Dec 02 09:23:37 EST 2016',1);
/*!40000 ALTER TABLE `Transaction` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!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 */;