-
Notifications
You must be signed in to change notification settings - Fork 0
/
ion.sql
157 lines (140 loc) · 6.02 KB
/
ion.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
/*
Navicat MySQL Data Transfer
Source Server : mysql
Source Server Version : 50615
Source Host : localhost:3306
Source Database : ion
Target Server Type : MYSQL
Target Server Version : 50615
File Encoding : 65001
Date: 2016-05-04 13:57:27
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for answertable
-- ----------------------------
DROP TABLE IF EXISTS `answertable`;
CREATE TABLE `answertable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`question_id` int(11) NOT NULL,
`time` datetime DEFAULT NULL,
`answer_student_number` varchar(255) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of answertable
-- ----------------------------
INSERT INTO `answertable` VALUES ('15', '11', '2016-04-24 19:14:58', '0000', '0000');
INSERT INTO `answertable` VALUES ('16', '11', '2016-04-24 19:26:23', '0000', 'hello');
-- ----------------------------
-- Table structure for fedback
-- ----------------------------
DROP TABLE IF EXISTS `fedback`;
CREATE TABLE `fedback` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_number` varchar(255) DEFAULT NULL,
`time` datetime DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fedback
-- ----------------------------
INSERT INTO `fedback` VALUES ('3', '0000', '2016-04-24 19:28:32', 'hello');
INSERT INTO `fedback` VALUES ('4', '0000', '2016-04-24 19:28:57', 'test');
-- ----------------------------
-- Table structure for ordertable
-- ----------------------------
DROP TABLE IF EXISTS `ordertable`;
CREATE TABLE `ordertable` (
`order_id` int(11) NOT NULL AUTO_INCREMENT,
`release_student_number` varchar(11) DEFAULT NULL,
`time` datetime DEFAULT NULL,
`startLocation` varchar(255) DEFAULT NULL,
`endLocation` varchar(255) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`lable` varchar(255) DEFAULT NULL,
`tip` double DEFAULT NULL,
`acceptance_student_number` varchar(11) DEFAULT NULL,
`score` double DEFAULT '-1',
`state` varchar(255) DEFAULT '0',
`complaint_content` varchar(255) DEFAULT NULL,
`complaint_time` datetime DEFAULT NULL,
`complaint_student_number` varchar(255) DEFAULT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ordertable
-- ----------------------------
INSERT INTO `ordertable` VALUES ('22', '456', '2016-04-24 18:01:12', '寝室A', '寝室A', 'test1', '跑腿', '5', null, '-1', '0', null, null, null);
INSERT INTO `ordertable` VALUES ('23', '111', '2016-04-24 18:37:43', '寝室A', '教学楼A', 'test01', '跑腿', '12', null, '-1', '0', null, null, null);
INSERT INTO `ordertable` VALUES ('24', '111', '2016-04-24 18:38:13', '教学楼A', '寝室A', 'test02', '租赁', '13', '222', '5', '2', null, null, null);
INSERT INTO `ordertable` VALUES ('25', '222', '2016-04-24 18:39:25', '教学楼A', '寝室A', 'test03', '其他', '15', '0000', '5', '2', null, null, null);
INSERT INTO `ordertable` VALUES ('30', '0000', '2016-04-24 19:24:36', '寝室A', '教学楼A', 'test from 0000', '跑腿', '5', null, '-1', '0', null, null, null);
-- ----------------------------
-- Table structure for questiontable
-- ----------------------------
DROP TABLE IF EXISTS `questiontable`;
CREATE TABLE `questiontable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`student_number` varchar(255) DEFAULT NULL,
`question` varchar(255) DEFAULT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of questiontable
-- ----------------------------
INSERT INTO `questiontable` VALUES ('11', '222', 'from test2', '2016-04-24 18:40:40');
INSERT INTO `questiontable` VALUES ('13', '0000', 'test from 0000', '2016-04-24 19:26:47');
-- ----------------------------
-- Table structure for schoollocation
-- ----------------------------
DROP TABLE IF EXISTS `schoollocation`;
CREATE TABLE `schoollocation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`school` varchar(255) DEFAULT NULL,
`location` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of schoollocation
-- ----------------------------
INSERT INTO `schoollocation` VALUES ('3', 'xxxx', '寝室A');
INSERT INTO `schoollocation` VALUES ('4', 'xxxx', '教学楼A');
-- ----------------------------
-- Table structure for usertable
-- ----------------------------
DROP TABLE IF EXISTS `usertable`;
CREATE TABLE `usertable` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`student_number` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`student_name` varchar(255) DEFAULT NULL,
`sex` varchar(255) DEFAULT NULL,
`cell_phone` varchar(255) DEFAULT NULL,
`school` varchar(255) DEFAULT NULL,
`average_score` double DEFAULT '0',
`amount` int(11) DEFAULT '0',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of usertable
-- ----------------------------
INSERT INTO `usertable` VALUES ('26', '111', '111', 'test1', '男', '12345678901', 'xxxx', '0', '0');
INSERT INTO `usertable` VALUES ('27', '222', '222', 'test2', '女', '36925814708', 'xxxx', '9', '1');
INSERT INTO `usertable` VALUES ('30', '0000', '0000', 'test0', '男', '14725836907', 'xxxx', '5', '1');
-- ----------------------------
-- Function structure for count_answer
-- ----------------------------
DROP FUNCTION IF EXISTS `count_answer`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `count_answer`(q_id INT(11)) RETURNS int(11)
BEGIN
DECLARE val int(11) default 0;
SET val = (SELECT COUNT(*) FROM answertable a WHERE question_id = q_id );
RETURN val;
END
;;
DELIMITER ;