Skip to content

Instantly share code, notes, and snippets.

View querafael's full-sized avatar

Rafael de Souza Queiroz querafael

View GitHub Profile

Brazilian Victories - 5 Cups

FIFA RANK 2nd

20 APPEARANCES / 12 QUALIFYING CAMPAIGNS

FIRST FWC: 1930 LAST FWC: 2014

-- Brazil
select
"ID" as "Year",
"Winner", "Second", "Third", "Fourth",
"Country", "Name" as "Host Country", "Matches Played", "Goals Scored",
"Attendance"
from T_WORLDCUP where "Winner" = 'Brazil'
-- Germany
select
-- Brazil
select
"ID" as "Year",
"Winner", "Second", "Third", "Fourth",
"Country", "Name" as "Host Country", "Matches Played", "Goals Scored",
"Attendance"
from T_WORLDCUP where "Winner" = 'Brazil'
-- Germany
select
-- Code Snippet 3.7 - Updating World Cup Pipe Transformation to include Country Codes
SELECT
to_date(r1."Year" || '-1-1', 'yyyy-mm-dd') as VALID_FROM,
to_date(r1."Year" || '-12-31', 'yyyy-mm-dd') as VALID_TO,
r1."Year" as "ID",
r1."Country" as "Name",
country."ID" as "Country",
r1."Winner" as "Winner",
r1."Runners-Up" as "Second",
r1."Third" as "Third",
-- Code Snippet 1.1 Extracting time from Datetime column
to_timestamp(substring("Datetime", 15, 21), 'HH24:MI:SS')::time
-- Code Snippet 3.1  -  Draft of Pipe Transformation for matches.
SELECT
to_date("Datetime", 'DD Mon yyyy') as EVENT_DATE,
r1."MatchID" as "ID", -- bigint
r1."RoundID" as "RoundID", -- bigint
r1."Home Team Initials" as "HomeTeam", -- bigint