Skip to content

Instantly share code, notes, and snippets.

@tphdev
Created July 10, 2018 02:08
Show Gist options
  • Save tphdev/966f5bac5095cd8a4e09f079944d5286 to your computer and use it in GitHub Desktop.
Save tphdev/966f5bac5095cd8a4e09f079944d5286 to your computer and use it in GitHub Desktop.
representing data in schemas and records examples

Representing Data

Schemas + Records Examples

Schema

Tuples + Tables + Relations

LEAGUE
--------------
id                : INTEGER
name              : TEXT
	
	
TEAM
--------------
id                : INTEGER
name              : TEXT
year_established  : INTEGER
league_id         : INTEGER

	
PLAYER
--------------
id                : INTEGER
first_name        : TEXT
last_name         : TEXT
height            : INTEGER
team_id           : Integer

RECORDS

Saved in Tables as:

  • Rows (each record)
  • Columns (fields for a record)

All Records must have: a primary key

TEAM
--------------
id                : 1
name              : "Angry Birds"
year_established  : 2016

id                : 2
name              : "Dry Markers"
year_established  : 1998

	
PLAYER
--------------
id                : 1
first_name        : "Bill"
last_name         : "Goodguy"
height            : 188
team_id           : 2

id                : 2
first_name        : "Jim"
last_name         : "Badguy"
height            : 173
team_id           : 2

id                : 3
first_name        : "Jill"
last_name         : "Nicegirl"
height            : 190
team_id           : 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment