forked from Uyutaka/virtualStockPlatformWithMaven
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02create_db.sql
More file actions
50 lines (34 loc) · 1.23 KB
/
Copy path02create_db.sql
File metadata and controls
50 lines (34 loc) · 1.23 KB
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
DROP SCHEMA IF EXISTS `stock_platform`;
CREATE SCHEMA `stock_platform`;
use `stock_platform`;
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`balance` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `property`;
CREATE TABLE `property` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`num_stocks` int(11) NOT NULL,
`stock_name` varchar(45) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`user_id`)
REFERENCES `user` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
INSERT INTO `user` VALUES
(1,'David','Adams','123','david@colorado.edu', 10000.00),
(2,'John','Doe','123','john@colorado.edu',10000.00),
(3,'Ajay','Rao','123','ajay@colorado.edu', 10000.00),
(4,'Mary','Public','123','mary@colorado.edu',10000.00),
(5,'Maxwell','Dixon','123','max@lcolorado.edu',10000.00);
INSERT INTO `property` VALUES
(1, 10, 'GOOG', 1),
(2, 30, 'AMZN', 1);
SET FOREIGN_KEY_CHECKS = 1;