-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path0.0.5.sql
109 lines (98 loc) · 3.48 KB
/
0.0.5.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
/*
Navicat Premium Data Transfer
Source Server : 39.106.10.108
Source Server Type : MySQL
Source Server Version : 50725
Source Host : 39.106.10.108:3306
Source Schema : Project
Target Server Type : MySQL
Target Server Version : 50725
File Encoding : 65001
Date: 25/02/2019 22:10:03
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for AirQuality
-- ----------------------------
DROP TABLE IF EXISTS `AirQuality`;
CREATE TABLE `AirQuality` (
`aq_id` int(11) NOT NULL AUTO_INCREMENT,
`aqi` int(255) NOT NULL,
`publish_platform` varchar(255) NOT NULL,
`dominent_pol` varchar(255) NOT NULL,
`iaqi` int(255) NOT NULL,
PRIMARY KEY (`aq_id`),
KEY `airquality_iaqi` (`iaqi`),
CONSTRAINT `airquality_iaqi` FOREIGN KEY (`iaqi`) REFERENCES `IAQI` (`iaqi_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for IAQI
-- ----------------------------
DROP TABLE IF EXISTS `IAQI`;
CREATE TABLE `IAQI` (
`iaqi_id` int(11) NOT NULL AUTO_INCREMENT,
`co` double(255,0) DEFAULT NULL,
`no2` double(255,0) DEFAULT NULL,
`o3` double(255,0) DEFAULT NULL,
`p` double(255,0) DEFAULT NULL,
`pm10` double(255,0) DEFAULT NULL,
`pm25` double(255,0) DEFAULT NULL,
`so2` double(255,0) DEFAULT NULL,
PRIMARY KEY (`iaqi_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for Location
-- ----------------------------
DROP TABLE IF EXISTS `Location`;
CREATE TABLE `Location` (
`l_id` int(11) NOT NULL AUTO_INCREMENT,
`latitude` varchar(255) DEFAULT NULL,
`longitude` varchar(255) DEFAULT NULL,
PRIMARY KEY (`l_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for Temp
-- ----------------------------
DROP TABLE IF EXISTS `Temp`;
CREATE TABLE `Temp` (
`t_id` int(11) NOT NULL AUTO_INCREMENT,
`min` int(255) NOT NULL,
`max` int(255) NOT NULL,
`t_time` datetime NOT NULL,
PRIMARY KEY (`t_id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for Weather
-- ----------------------------
DROP TABLE IF EXISTS `Weather`;
CREATE TABLE `Weather` (
`w_id` int(11) NOT NULL AUTO_INCREMENT,
`detail` varchar(255) NOT NULL,
`temp` int(255) NOT NULL,
`wind` int(255) NOT NULL,
`pressure` int(255) NOT NULL,
`air_quality` int(255) NOT NULL,
`location` int(255) NOT NULL,
`w_time` datetime NOT NULL,
PRIMARY KEY (`w_id`),
KEY `fk_Weather_Temp_1` (`temp`) USING BTREE,
KEY `fk_Weather_Wind_1` (`wind`) USING BTREE,
KEY `fk_Weather_Location_1` (`location`) USING BTREE,
KEY `fk_Weather_AirQuality` (`air_quality`) USING BTREE,
CONSTRAINT `weather_air` FOREIGN KEY (`air_quality`) REFERENCES `AirQuality` (`aq_id`),
CONSTRAINT `weather_location` FOREIGN KEY (`location`) REFERENCES `Location` (`l_id`),
CONSTRAINT `weather_temp` FOREIGN KEY (`temp`) REFERENCES `Temp` (`t_id`),
CONSTRAINT `weather_wind` FOREIGN KEY (`wind`) REFERENCES `Wind` (`w_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for Wind
-- ----------------------------
DROP TABLE IF EXISTS `Wind`;
CREATE TABLE `Wind` (
`w_id` int(11) NOT NULL AUTO_INCREMENT,
`speed` int(11) DEFAULT NULL,
`direction` int(255) DEFAULT NULL,
PRIMARY KEY (`w_id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
SET FOREIGN_KEY_CHECKS = 1;