forked from auvch/join-order-benchmark-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
176 lines (155 loc) · 4.35 KB
/
schema.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
-- This is from [email protected]:winkyao/join-order-benchmark.git, csv_files/schematext.sql
DROP DATABASE IF EXISTS imdbload;
CREATE DATABASE imdbload;
USE imdbload;
CREATE TABLE aka_name (
id integer NOT NULL PRIMARY KEY,
person_id integer NOT NULL,
name varchar(512),
imdb_index varchar(3),
name_pcode_cf varchar(11),
name_pcode_nf varchar(11),
surname_pcode varchar(11),
md5sum varchar(65)
) character set utf8 ;
CREATE TABLE aka_title (
id integer NOT NULL PRIMARY KEY,
movie_id integer NOT NULL,
title varchar(1000),
imdb_index varchar(4),
kind_id integer NOT NULL,
production_year integer,
phonetic_code varchar(5),
episode_of_id integer,
season_nr integer,
episode_nr integer,
note varchar(72),
md5sum varchar(32)
) character set utf8 ;
-- psergey: changed "note text" to "note varchar(1000)" below:
CREATE TABLE cast_info (
id integer NOT NULL PRIMARY KEY,
person_id integer NOT NULL,
movie_id integer NOT NULL,
person_role_id integer,
note varchar(1000),
nr_order integer,
role_id integer NOT NULL
) character set utf8 ;
CREATE TABLE char_name (
id integer NOT NULL PRIMARY KEY,
name varchar(512) NOT NULL,
imdb_index varchar(2),
imdb_id integer,
name_pcode_nf varchar(5),
surname_pcode varchar(5),
md5sum varchar(32)
) character set utf8 ;
CREATE TABLE comp_cast_type (
id integer NOT NULL PRIMARY KEY,
kind varchar(32) NOT NULL
) character set utf8 ;
CREATE TABLE company_name (
id integer NOT NULL PRIMARY KEY,
name varchar(512) NOT NULL,
country_code varchar(6),
imdb_id integer,
name_pcode_nf varchar(5),
name_pcode_sf varchar(5),
md5sum varchar(32)
) character set utf8 ;
CREATE TABLE company_type (
id integer NOT NULL PRIMARY KEY,
kind varchar(32)
) character set utf8 ;
CREATE TABLE complete_cast (
id integer NOT NULL PRIMARY KEY,
movie_id integer,
subject_id integer NOT NULL,
status_id integer NOT NULL
) character set utf8 ;
CREATE TABLE info_type (
id integer NOT NULL PRIMARY KEY,
info varchar(32) NOT NULL
) character set utf8 ;
CREATE TABLE keyword (
id integer NOT NULL PRIMARY KEY,
keyword varchar(512) NOT NULL,
phonetic_code varchar(5)
) character set utf8 ;
CREATE TABLE kind_type (
id integer NOT NULL PRIMARY KEY,
kind varchar(15)
) character set utf8 ;
CREATE TABLE link_type (
id integer NOT NULL PRIMARY KEY,
link varchar(32) NOT NULL
) character set utf8 ;
CREATE TABLE movie_companies (
id integer NOT NULL PRIMARY KEY,
movie_id integer NOT NULL,
company_id integer NOT NULL,
company_type_id integer NOT NULL,
note text
) character set utf8 ;
CREATE TABLE movie_info_idx (
id integer NOT NULL PRIMARY KEY,
movie_id integer NOT NULL,
info_type_id integer NOT NULL,
info text NOT NULL,
note text
) character set utf8 ;
CREATE TABLE movie_keyword (
id integer NOT NULL PRIMARY KEY,
movie_id integer NOT NULL,
keyword_id integer NOT NULL
) character set utf8 ;
CREATE TABLE movie_link (
id integer NOT NULL PRIMARY KEY,
movie_id integer NOT NULL,
linked_movie_id integer NOT NULL,
link_type_id integer NOT NULL
) character set utf8 ;
CREATE TABLE name (
id integer NOT NULL PRIMARY KEY,
name varchar(512) NOT NULL,
imdb_index varchar(9),
imdb_id integer,
gender varchar(1),
name_pcode_cf varchar(5),
name_pcode_nf varchar(5),
surname_pcode varchar(5),
md5sum varchar(32)
) character set utf8 ;
CREATE TABLE role_type (
id integer NOT NULL PRIMARY KEY,
role varchar(32) NOT NULL
) character set utf8;
CREATE TABLE title (
id integer NOT NULL PRIMARY KEY,
title varchar(512) NOT NULL,
imdb_index varchar(5),
kind_id integer NOT NULL,
production_year integer,
imdb_id integer,
phonetic_code varchar(5),
episode_of_id integer,
season_nr integer,
episode_nr integer,
series_years varchar(49),
md5sum varchar(32)
) character set utf8;
CREATE TABLE movie_info (
id integer NOT NULL PRIMARY KEY,
movie_id integer NOT NULL,
info_type_id integer NOT NULL,
info text NOT NULL,
note text
) character set utf8;
CREATE TABLE person_info (
id integer NOT NULL PRIMARY KEY,
person_id integer NOT NULL,
info_type_id integer NOT NULL,
info text NOT NULL,
note text
) character set utf8;