Parameter Types

The SDQL data types are:

  • Number (points, first downs, home runs, etc.)
  • String (team, division, conference, etc.)
  • List (quarter scores, inning runs, umpires, etc.)
  • Date (date)
  • Line (MLB line, run line, etc.)

number

SDQL database numbers are Python integers and Python floats. Number parameters can be combined using the usual math symbols: +, -, / and * (for multiplication).

To see the date and team name for NFL teams after they had more than 10 yards per pass, use the SDQL:
date, team @ p:passing yards > 10 * p:passes

string

Database strings have all of the expected properties of Python strings.

To find all NBA team names that do not end in an s, use the SDQL:
Unique(team) @ team[-1] != ‘s’
To find all MLB teams with a two-word name, use the SDQL:
U(team) @ len(team.split()) = 2

Unique (abbreviated U) is an example of an SDQL aggregator (see Aggregators) and len is a Python built-in.

list

Database lists have all of the expected properties of Python lists. The contents of lists are accessed by offset (starting at 0) using square brackets.

To see the date, team and opponent for MLB teams that scored five runs in the first inning, use the SDQL:
date, team, o:team @ inning runs[0] = 5

The list indexing starts at 0, so inning runs[0] gives runs in the first inning and inning runs[8] gives runs in the ninth inning.

To see the date, team and opponent for MLB teams that scored a total of ten runs in the first three innings, use the SDQL:
date, team, o:team @ sum(inning runs[:3]) = 10

sum is a Python built-in method and used here to add up the first three values of the inning runs list.

Pythonic list splicing works both ways: to find non-extra inning MLB games in which the team scored one run in each of the last four innings, use the SDQL:
date, team @ inning runs[-4:] = [1,1,1,1] and len(inning runs)=9

date

The date parameter has its own type to allow convenient addition and subtraction. A date minus a date is a number while a date plus or minus a number is a date.

To see how NBA teams have performed when looking ahead to at least three days off, use the SDQL:
S(points>o:points) as ‘Wins’,S(points<o:points) as ‘Losses’@n:date - date > 3
To see how NFL teams have done against the line when they have more than a week of rest, use the SDQL:
S(points+line>o:points) as ‘ATS Wins’,S(points+line<o:points) as ‘ATS Losses’@date - p:date > 7