forked from viktorleis/job
-
Notifications
You must be signed in to change notification settings - Fork 0
/
13c.sql
31 lines (31 loc) · 894 Bytes
/
13c.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
SELECT min(cn.name) AS producing_company,
min(miidx.info) AS rating,
min(t.title) AS movie_about_winning
FROM company_name AS cn,
company_type AS ct,
info_type AS it,
info_type AS it2,
kind_type AS kt,
movie_companies AS mc,
movie_info AS mi,
movie_info_idx AS miidx,
title AS t
WHERE cn.country_code ='[us]'
AND ct.kind ='production companies'
AND it.info ='rating'
AND it2.info ='release dates'
AND kt.kind ='movie'
AND t.title != ''
AND (t.title LIKE 'Champion%'
OR t.title LIKE 'Loser%')
AND mi.movie_id = t.id
AND it2.id = mi.info_type_id
AND kt.id = t.kind_id
AND mc.movie_id = t.id
AND cn.id = mc.company_id
AND ct.id = mc.company_type_id
AND miidx.movie_id = t.id
AND it.id = miidx.info_type_id
AND mi.movie_id = miidx.movie_id
AND mi.movie_id = mc.movie_id
AND miidx.movie_id = mc.movie_id;