-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextract.sql
More file actions
34 lines (34 loc) · 815 Bytes
/
Copy pathextract.sql
File metadata and controls
34 lines (34 loc) · 815 Bytes
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
COPY (
SELECT
tournament AS tourney_name,
level AS tourney_level,
surface,
draw_size,
to_char(event_date,'YYYY-MM-DD') AS tourney_date,
round,
best_of,
minutes,
winner_name,
winner_hand,
winner_ht,
upper(winner_country) AS winner_ioc,
round(winner_age::numeric,1) AS winner_age,
winner_rank,
winner_seed,
winner_entry,
loser_name,
loser_hand,
loser_ht,
upper(loser_country) AS loser_ioc,
round(loser_age::numeric,1) AS loser_age,
loser_rank,
loser_seed,
loser_entry,
score,
outcome
FROM archive_matches
WHERE tour='atp'
AND level IN ('G','M','A','F')
AND extract(year from event_date)=2015
ORDER BY event_date, tournament, id
) TO STDOUT WITH (FORMAT csv, HEADER true);