-
Notifications
You must be signed in to change notification settings - Fork 0
/
relations.sql
67 lines (58 loc) · 1.44 KB
/
relations.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
CREATE TABLE Counts (gene_id char(10) not null, spot_id varchar(30) not null, gene_counts int,
PRIMARY KEY (gene_id, spot_id)
);
CREATE TABLE SpotData (
spot_id varchar(30) not null,
cell_count int,
layer_name varchar(15),
sample_id int,
in_tissue int,
array_row int,
array_col int,
pixel_row int,
pixel_col int,
PRIMARY KEY (spot_id)
FOREIGN KEY (sample_id) REFERENCES TissueSample(sample_id)
);
CREATE TABLE GeneData (
gene_id char(10) not null,
gene_name varchar(15)
PRIMARY KEY (gene_id)
);
CREATE TABLE Institutions (
institution_id char(6) not null,
name varchar(30),
street_address varchar(30),
zip_code int
PRIMARY KEY (institution_id)
);
CREATE TABLE Users (
user_id varchar(15) not null,
fname varchar(25),
lname varchar(25),
password varchar(30),
username varchar(15),
institution_id char(6),
date_joined date,
emailID varchar(30),
phone_num int
PRIMARY KEY (user_id),
);
CREATE TABLE Zipcodes (
zipcode int not null,
city varchar(15),
state varchar(2)
);
CREATE TABLE TissueSample (
sample_id int not null,
br_region varchar(10),
platform_num varchar(25),
tr_time int,
tr_date date,
directory varchar(30),
scanned_by varchar(15),
scan_date date,
scan_time int
PRIMARY KEY (sample_id)
FOREIGN KEY (scanned_by) REFERENCES Users(user_id)
);