Skip to content

Instantly share code, notes, and snippets.

@yllus
Last active December 15, 2016 15:29
Show Gist options
  • Select an option

  • Save yllus/35c187b999afd0c3096579901ef4e6b3 to your computer and use it in GitHub Desktop.

Select an option

Save yllus/35c187b999afd0c3096579901ef4e6b3 to your computer and use it in GitHub Desktop.

Players

The query:

SELECT Player.CFLCentralID, 
Player.FirstName, 
Player.MiddleName, 
Player.LastName, 
Player.BirthDate, 
Player.BirthPlace, 
Player.Height, 
Player.Weight,  
Player.RookieYear, 
Player.ForeignPlayer, 
Player.SchoolID, 
Player.SchoolName, 
Position.PositionID, 
Position.PositionType AS OffenceOrDefence,
Position.Abbreviation, 
Position.Description 
FROM Player 
LEFT OUTER JOIN Position ON Position.PositionID = Player.PositionID;

Games

The query:

SELECT *
FROM apiGameSchedule 
WHERE 1=1 
ORDER BY GameDay ASC 

Penalties

The query:

SELECT StatPenaltyInfo.* 
FROM StatPenaltyInfo
JOIN Game ON Game.Season = StatPenaltyInfo.Season 
AND Game.GameTypeID = StatPenaltyInfo.GameTypeID 
AND Game.GameNum = StatPenaltyInfo.GameNum;

Passes

The query:

SELECT * 
FROM StatGamePass;

Rushes

The query:

SELECT * 
FROM StatGameRush;

Plays

SELECT * 
FROM StatPlay;

Play Details

A single Play contains many events that occur within it; for example, the kickoff at the start of a game is a Play that usually consists of a kick, a kick return and a tackle. (In this database there are even more events than just those listed for the sake of calculating net yards and other things, but you get the idea.) The query below provides a list of those events per each Play.

SELECT StatPlayDetail.*, 
StatType.StatTypeDescription, 
GameRoster.GameRosterID, GameRoster.PlayerID, GameRoster.PlayerFirstName, GameRoster.PlayerLastName, GameRoster.JerseyNumber 
FROM StatPlayDetail
JOIN StatType ON StatPlayDetail.StatTypeID = StatType.StatTypeID 
JOIN GameRoster ON GameRoster.GameRosterID = StatPlayDetail.StatCreditedTo; 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment