-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtidey_setup_tables.sql
71 lines (64 loc) · 1.83 KB
/
tidey_setup_tables.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
use brk3269;
drop table IF EXISTS station;
drop table IF EXISTS tides;
drop table IF EXISTS wind;
drop table IF EXISTS tempPressure;
drop table IF EXISTS air_temp;
drop table IF EXISTS water_temp;
drop table IF EXISTS air_pressure;
create table station
(latitude varchar(11),
longitude varchar(11),
location varchar(30) not null,
primary key (location)
);
create table tides
(location varchar(30) not null,
high1 decimal(5,1) not null,
low1 decimal(5,1) not null,
high2 decimal(5,1) not null,
low2 decimal(5,1) not null,
tdate date not null,
primary key(tdate)
);
create table wind
(tdate date not null,
speed decimal(5,1) not null,
direction varchar(25) not null,
location varchar(30) not null,
ttime varchar(25) not null,
primary key (ttime)
);
create table tempPressure
(tdate date not null,
air_temperature decimal(5,1) not null,
water_temperature decimal(5,1) not null,
pressure decimal(5,1) not null,
location varchar(30) not null,
ttime varchar(25) not null,
primary key (ttime)
);
create table air_temp
(ttime varchar(25) not null,
air_temperature decimal(5,1) not null,
location varchar(30) not null,
primary key (ttime),
foreign key (location) references station(location)
ON UPDATE CASCADE ON DELETE RESTRICT
);
create table water_temp
(ttime varchar(25) not null,
water_temperature decimal(5,1) not null,
location varchar(30) not null,
primary key (ttime),
foreign key (location) references station(location)
ON UPDATE CASCADE ON DELETE RESTRICT
);
create table air_pressure
(ttime varchar(25) not null,
air_pressure decimal(5,1) not null,
location varchar(30) not null,
primary key (ttime),
foreign key (location) references station(location)
ON UPDATE CASCADE ON DELETE RESTRICT
);