forked from kenkoooo/AtCoderProblems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase-definition.sql
126 lines (111 loc) · 3.39 KB
/
database-definition.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
SET client_encoding = 'UTF8';
DROP TABLE IF EXISTS submissions;
CREATE TABLE submissions (
id BIGINT NOT NULL,
epoch_second BIGINT NOT NULL,
problem_id VARCHAR(255) NOT NULL,
contest_id VARCHAR(255) NOT NULL,
user_id VARCHAR(255) NOT NULL,
language VARCHAR(255) NOT NULL,
point DOUBLE PRECISION NOT NULL,
length INT NOT NULL,
result VARCHAR(255) NOT NULL,
execution_time INT,
PRIMARY KEY (id)
);
CREATE INDEX ON submissions (user_id);
CREATE INDEX ON submissions (epoch_second);
DROP TABLE IF EXISTS problems;
CREATE TABLE problems (
id VARCHAR(255) NOT NULL,
contest_id VARCHAR(255) NOT NULL,
title VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
DROP TABLE IF EXISTS contests;
CREATE TABLE contests (
id VARCHAR(255) NOT NULL,
start_epoch_second BIGINT NOT NULL,
duration_second BIGINT NOT NULL,
title VARCHAR(255) NOT NULL,
rate_change VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
DROP TABLE IF EXISTS solver;
CREATE TABLE solver (
problem_id VARCHAR(255) NOT NULL,
user_count INT NOT NULL,
PRIMARY KEY (problem_id)
);
DROP TABLE IF EXISTS shortest;
CREATE TABLE shortest (
contest_id VARCHAR(255) NOT NULL,
problem_id VARCHAR(255) NOT NULL,
submission_id BIGINT NOT NULL,
PRIMARY KEY (problem_id)
);
DROP TABLE IF EXISTS fastest;
CREATE TABLE fastest (
contest_id VARCHAR(255) NOT NULL,
problem_id VARCHAR(255) NOT NULL,
submission_id BIGINT NOT NULL,
PRIMARY KEY (problem_id)
);
DROP TABLE IF EXISTS first;
CREATE TABLE first (
contest_id VARCHAR(255) NOT NULL,
problem_id VARCHAR(255) NOT NULL,
submission_id BIGINT NOT NULL,
PRIMARY KEY (problem_id)
);
DROP TABLE IF EXISTS accepted_count;
CREATE TABLE accepted_count (
user_id VARCHAR(255) NOT NULL,
problem_count INT NOT NULL,
PRIMARY KEY (user_id)
);
DROP TABLE IF EXISTS points;
CREATE TABLE points (
problem_id VARCHAR(255) NOT NULL,
point DOUBLE PRECISION,
predict DOUBLE PRECISION,
PRIMARY KEY (problem_id)
);
DROP TABLE IF EXISTS rated_point_sum;
CREATE TABLE rated_point_sum (
user_id VARCHAR(255) NOT NULL,
point_sum DOUBLE PRECISION NOT NULL,
PRIMARY KEY (user_id)
);
DROP TABLE IF EXISTS language_count;
CREATE TABLE language_count (
user_id VARCHAR(255) NOT NULL,
simplified_language VARCHAR(255) NOT NULL,
problem_count INT NOT NULL,
PRIMARY KEY (user_id, simplified_language)
);
DROP TABLE IF EXISTS predicted_rating;
CREATE TABLE predicted_rating (
user_id VARCHAR(255) NOT NULL,
rating DOUBLE PRECISION,
PRIMARY KEY (user_id)
);
DROP TABLE IF EXISTS contest_problem;
CREATE TABLE contest_problem (
contest_id VARCHAR(255) NOT NULL,
problem_id VARCHAR(255) NOT NULL,
PRIMARY KEY (contest_id, problem_id)
);
DROP TABLE IF EXISTS performances;
CREATE TABLE performances (
contest_id VARCHAR(255) NOT NULL,
user_id VARCHAR(255) NOT NULL,
inner_performance BIGINT NOT NULL,
PRIMARY KEY (contest_id, user_id)
);
DROP TABLE IF EXISTS minimum_performances;
CREATE TABLE minimum_performances (
problem_id VARCHAR(255) NOT NULL,
minimum_performance BIGINT NOT NULL,
PRIMARY KEY (problem_id)
);