Repository navigation
Expand file tree
/
Copy pathA2.sql
More file actions
100 lines (69 loc) · 3.2 KB
/
Copy pathA2.sql
File metadata and controls
100 lines (69 loc) · 3.2 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
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
/*
SQLyog Trial v11.42 (64 bit)
MySQL - 5.6.17 : Database - comp5347_assignment2
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!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 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`comp5347_assignment2` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `comp5347_assignment2`;
/*Table structure for table `cartitem` */
DROP TABLE IF EXISTS `cartitem`;
CREATE TABLE `cartitem` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) DEFAULT NULL,
`title` varchar(255) DEFAULT NULL,
`quantity` int(11) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
/*Data for the table `cartitem` */
insert into `cartitem`(`id`,`order_id`,`title`,`quantity`,`price`) values (4,1,'IMG_8659',3,9),(13,1,'鏌寸姮鎲ㄥ悏',5,15),(14,1,'Let It Bee',1,27);
/*Table structure for table `destination` */
DROP TABLE IF EXISTS `destination`;
CREATE TABLE `destination` (
`city` varchar(255) NOT NULL,
`cost` int(11) DEFAULT NULL,
PRIMARY KEY (`city`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `destination` */
insert into `destination`(`city`,`cost`) values ('Harbin',20),('Kathmandu',30),('Sydney',10);
/*Table structure for table `order` */
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(255) DEFAULT NULL,
`destination` varchar(255) DEFAULT NULL,
`status` varchar(255) NOT NULL DEFAULT 'processing',
`shipping_fee` int(11) DEFAULT NULL,
`final_cost` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*Data for the table `order` */
insert into `order`(`id`,`user`,`destination`,`status`,`shipping_fee`,`final_cost`) values (1,'guichi','Harbin','processing',11,22);
/*Table structure for table `user_roles` */
DROP TABLE IF EXISTS `user_roles`;
CREATE TABLE `user_roles` (
`user_name` varchar(15) NOT NULL,
`role_name` varchar(15) NOT NULL,
PRIMARY KEY (`user_name`,`role_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `user_roles` */
insert into `user_roles`(`user_name`,`role_name`) values ('admin','Admin'),('angelar','Member'),('guichi','Member');
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`user_name` varchar(15) NOT NULL,
`user_pass` varchar(15) NOT NULL,
PRIMARY KEY (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `users` */
insert into `users`(`user_name`,`user_pass`) values ('admin','admin'),('angelar','angelar'),('guichi','guichi');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;