forked from gregrahn/join-order-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
27c.sql
56 lines (55 loc) · 1.57 KB
/
27c.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
SELECT MIN(cn.name) AS producing_company,
MIN(lt.link) AS link_type,
MIN(t.title) AS complete_western_sequel
FROM complete_cast AS cc,
comp_cast_type AS cct1,
comp_cast_type AS cct2,
company_name AS cn,
company_type AS ct,
keyword AS k,
link_type AS lt,
movie_companies AS mc,
movie_info AS mi,
movie_keyword AS mk,
movie_link AS ml,
title AS t
WHERE cct1.kind = 'cast'
AND cct2.kind LIKE 'complete%'
AND cn.country_code !='[pl]'
AND (cn.name LIKE '%Film%'
OR cn.name LIKE '%Warner%')
AND ct.kind ='production companies'
AND k.keyword ='sequel'
AND lt.link LIKE '%follow%'
AND mc.note IS NULL
AND mi.info IN ('Sweden',
'Norway',
'Germany',
'Denmark',
'Swedish',
'Denish',
'Norwegian',
'German',
'English')
AND t.production_year BETWEEN 1950 AND 2010
AND lt.id = ml.link_type_id
AND ml.movie_id = t.id
AND t.id = mk.movie_id
AND mk.keyword_id = k.id
AND t.id = mc.movie_id
AND mc.company_type_id = ct.id
AND mc.company_id = cn.id
AND mi.movie_id = t.id
AND t.id = cc.movie_id
AND cct1.id = cc.subject_id
AND cct2.id = cc.status_id
AND ml.movie_id = mk.movie_id
AND ml.movie_id = mc.movie_id
AND mk.movie_id = mc.movie_id
AND ml.movie_id = mi.movie_id
AND mk.movie_id = mi.movie_id
AND mc.movie_id = mi.movie_id
AND ml.movie_id = cc.movie_id
AND mk.movie_id = cc.movie_id
AND mc.movie_id = cc.movie_id
AND mi.movie_id = cc.movie_id;