-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate_SQL_Tables.sql
More file actions
31 lines (29 loc) · 825 Bytes
/
Copy pathCreate_SQL_Tables.sql
File metadata and controls
31 lines (29 loc) · 825 Bytes
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
-- Create the 'crops' table
CREATE TABLE IF NOT EXISTS crops (
id INT AUTO_INCREMENT PRIMARY KEY,
cropName TINYTEXT NOT NULL,
datePlanted DATE NOT NULL,
timePlanted TIME NOT NULL,
location TINYTEXT,
baselineTemp FLOAT NOT NULL,
harvestStartGDD INT NOT NULL,
harvestEndGDD INT NOT NULL,
accumulatedGDD FLOAT,
harvestPercent FLOAT,
predictedHarvestStart DATE,
predictedHarvestEnd DATE
);
-- Create the 'temperatureReadings' table
CREATE TABLE IF NOT EXISTS temperatureReadings (
ReadingNo INT AUTO_INCREMENT PRIMARY KEY,
Date DATE,
Time TIME,
Device_ID TINYTEXT,
Temperature FLOAT
);
-- Create the 'averageTemperatures' table
CREATE TABLE IF NOT EXISTS averageTemperatures (
deviceID TINYTEXT,
date DATE PRIMARY KEY,
averageTemperature FLOAT
);