Chinook

1 Chinook 🔗 Foreign Key FK_Album Artist Album ➔ Artist ( ArtistId ) 🔗 Foreign Key FK_Album Artist Album ➔ Artist ( ArtistId ) 🔗 Foreign Key FK_Customer Employee Customer ➔ Employee ( SupportRepId -> EmployeeId ) 🔗 Foreign Key FK_Customer Employee Customer ➔ Employee ( SupportRepId -> EmployeeId ) 🔗 Foreign Key FK_Employee Employee Employee ➔ Employee ( ReportsTo -> EmployeeId ) 🔗 Foreign Key FK_Employee Employee Employee ➔ Employee ( ReportsTo -> EmployeeId ) 🔗 Foreign Key FK_Invoice Customer Invoice ➔ Customer ( CustomerId ) 🔗 Foreign Key FK_Invoice Customer Invoice ➔ Customer ( CustomerId ) 🔗 Foreign Key FK_InvoiceLine Invoice InvoiceLine ➔ Invoice ( InvoiceId ) 🔗 Foreign Key FK_InvoiceLine Invoice InvoiceLine ➔ Invoice ( InvoiceId ) 🔗 Foreign Key FK_InvoiceLine Track InvoiceLine ➔ Track ( TrackId ) 🔗 Foreign Key FK_InvoiceLine Track InvoiceLine ➔ Track ( TrackId ) 🔗 Foreign Key FK_PlaylistTrack Playlist PlaylistTrack ➔ Playlist ( PlaylistId ) 🔗 Foreign Key FK_PlaylistTrack Playlist PlaylistTrack ➔ Playlist ( PlaylistId ) 🔗 Foreign Key FK_PlaylistTrack Track PlaylistTrack ➔ Track ( TrackId ) 🔗 Foreign Key FK_PlaylistTrack Track PlaylistTrack ➔ Track ( TrackId ) 🔗 Foreign Key FK_Track Album Track ➔ Album ( AlbumId ) 🔗 Foreign Key FK_Track Album Track ➔ Album ( AlbumId ) 🔗 Foreign Key FK_Track Genre Track ➔ Genre ( GenreId ) 🔗 Foreign Key FK_Track Genre Track ➔ Genre ( GenreId ) 🔗 Foreign Key FK_Track MediaType Track ➔ MediaType ( MediaTypeId ) 🔗 Foreign Key FK_Track MediaType Track ➔ MediaType ( MediaTypeId ) Table Default.AlbumAlbum 🔑 Pk PK_Album ( AlbumId ) ⧉ AlbumId * integer ↙ Track( AlbumId )AlbumId INTEGER🔗 Referred by Track ( AlbumId ) ⧉ Title * textTitle TEXT 🔍 IFK_AlbumArtistId ( ArtistId ) ⧉ ArtistId * integer ↗ Artist( ArtistId )ArtistId INTEGER🔗 References Artist ( ArtistId ) Table Default.ArtistArtist 🔑 Pk PK_Artist ( ArtistId ) ⧉ ArtistId * integer ↙ Album( ArtistId )ArtistId INTEGER🔗 Referred by Album ( ArtistId ) ⧉ Name textName TEXT Table Default.CustomerCustomer 🔑 Pk PK_Customer ( CustomerId ) ⧉ CustomerId * integer ↙ Invoice( CustomerId )CustomerId INTEGER🔗 Referred by Invoice ( CustomerId ) ⧉ FirstName * textFirstName TEXT ⧉ LastName * textLastName TEXT ⧉ Company textCompany TEXT ⧉ Address textAddress TEXT ⧉ City textCity TEXT ⧉ State textState TEXT ⧉ Country textCountry TEXT ⧉ PostalCode textPostalCode TEXT ⧉ Phone textPhone TEXT ⧉ Fax textFax TEXT ⧉ Email * textEmail TEXT 🔍 IFK_CustomerSupportRepId ( SupportRepId ) ⧉ SupportRepId integer ↗ Employee( EmployeeId )SupportRepId INTEGER🔗 References Employee ( SupportRepId -> EmployeeId ) Table Default.EmployeeEmployee 🔑 Pk PK_Employee ( EmployeeId ) ⧉ EmployeeId * integer ↙ Customer( SupportRepId ) ↙ Employee( ReportsTo )EmployeeId INTEGER🔗 Referred by Customer ( SupportRepId -> EmployeeId ) Referred by Employee ( ReportsTo -> EmployeeId ) ⧉ LastName * textLastName TEXT ⧉ FirstName * textFirstName TEXT ⧉ Title textTitle TEXT 🔍 IFK_EmployeeReportsTo ( ReportsTo ) ⧉ ReportsTo integer ↗ Employee( EmployeeId )ReportsTo INTEGER🔗 References Employee ( ReportsTo -> EmployeeId ) ⧉ BirthDate datetimeBirthDate DATETIME ⧉ HireDate datetimeHireDate DATETIME ⧉ Address textAddress TEXT ⧉ City textCity TEXT ⧉ State textState TEXT ⧉ Country textCountry TEXT ⧉ PostalCode textPostalCode TEXT ⧉ Phone textPhone TEXT ⧉ Fax textFax TEXT ⧉ Email textEmail TEXT Table Default.GenreGenre 🔑 Pk PK_Genre ( GenreId ) ⧉ GenreId * integer ↙ Track( GenreId )GenreId INTEGER🔗 Referred by Track ( GenreId ) ⧉ Name textName TEXT Table Default.InvoiceInvoice 🔑 Pk PK_Invoice ( InvoiceId ) ⧉ InvoiceId * integer ↙ InvoiceLine( InvoiceId )InvoiceId INTEGER🔗 Referred by InvoiceLine ( InvoiceId ) 🔍 IFK_InvoiceCustomerId ( CustomerId ) ⧉ CustomerId * integer ↗ Customer( CustomerId )CustomerId INTEGER🔗 References Customer ( CustomerId ) ⧉ InvoiceDate * datetimeInvoiceDate DATETIME ⧉ BillingAddress textBillingAddress TEXT ⧉ BillingCity textBillingCity TEXT ⧉ BillingState textBillingState TEXT ⧉ BillingCountry textBillingCountry TEXT ⧉ BillingPostalCode textBillingPostalCode TEXT ⧉ Total * numeric(10,2)Total NUMERIC(10,2) Table Default.InvoiceLineInvoiceLine 🔑 Pk PK_InvoiceLine ( InvoiceLineId ) ⧉ InvoiceLineId * integerInvoiceLineId INTEGER 🔍 IFK_InvoiceLineInvoiceId ( InvoiceId ) ⧉ InvoiceId * integer ↗ Invoice( InvoiceId )InvoiceId INTEGER🔗 References Invoice ( InvoiceId ) 🔍 IFK_InvoiceLineTrackId ( TrackId ) ⧉ TrackId * integer ↗ Track( TrackId )TrackId INTEGER🔗 References Track ( TrackId ) ⧉ UnitPrice * numeric(10,2)UnitPrice NUMERIC(10,2) ⧉ Quantity * integerQuantity INTEGER Table Default.MediaTypeMediaType 🔑 Pk PK_MediaType ( MediaTypeId ) ⧉ MediaTypeId * integer ↙ Track( MediaTypeId )MediaTypeId INTEGER🔗 Referred by Track ( MediaTypeId ) ⧉ Name textName TEXT Table Default.PlaylistPlaylist 🔑 Pk PK_Playlist ( PlaylistId ) ⧉ PlaylistId * integer ↙ PlaylistTrack( PlaylistId )PlaylistId INTEGER🔗 Referred by PlaylistTrack ( PlaylistId ) ⧉ Name textName TEXT Table Default.PlaylistTrackPlaylistTrack 🔑 Pk PK_PlaylistTrack ( PlaylistId, TrackId ) ⧉ PlaylistId * integer ↗ Playlist( PlaylistId )PlaylistId INTEGER🔗 References Playlist ( PlaylistId ) 🔑 Pk PK_PlaylistTrack ( PlaylistId, TrackId ) 🔍 IFK_PlaylistTrackTrackId ( TrackId ) ⧉ TrackId * integer ↗ Track( TrackId )TrackId INTEGER🔗 References Track ( TrackId ) Table Default.TrackTrack 🔑 Pk PK_Track ( TrackId ) ⧉ TrackId * integer ↙ InvoiceLine( TrackId ) ↙ PlaylistTrack( TrackId )TrackId INTEGER🔗 Referred by InvoiceLine ( TrackId ) Referred by PlaylistTrack ( TrackId ) ⧉ Name * textName TEXT 🔍 IFK_TrackAlbumId ( AlbumId ) ⧉ AlbumId integer ↗ Album( AlbumId )AlbumId INTEGER🔗 References Album ( AlbumId ) 🔍 IFK_TrackMediaTypeId ( MediaTypeId ) ⧉ MediaTypeId * integer ↗ MediaType( MediaTypeId )MediaTypeId INTEGER🔗 References MediaType ( MediaTypeId ) 🔍 IFK_TrackGenreId ( GenreId ) ⧉ GenreId integer ↗ Genre( GenreId )GenreId INTEGER🔗 References Genre ( GenreId ) ⧉ Composer textComposer TEXT ⧉ Milliseconds * integerMilliseconds INTEGER ⧉ Bytes integerBytes INTEGER ⧉ UnitPrice * numeric(10,2)UnitPrice NUMERIC(10,2)


Schema Default


Table Album
IdxColumn NameData Type
* AlbumId INTEGER NOT NULL
* Title TEXT NOT NULL
* ArtistId INTEGER NOT NULL
Foreign Key
FK_Album Artist ArtistId ↗ ❏ Artist
Referring Foreign Key
FK_Track Album AlbumId ↙ ❏ Track


Table Artist
IdxColumn NameData Type
* ArtistId INTEGER NOT NULL
  Name TEXT
Referring Foreign Key
FK_Album Artist ArtistId ↙ ❏ Album


Table Customer
IdxColumn NameData Type
* CustomerId INTEGER NOT NULL
* FirstName TEXT NOT NULL
* LastName TEXT NOT NULL
  Company TEXT
  Address TEXT
  City TEXT
  State TEXT
  Country TEXT
  PostalCode TEXT
  Phone TEXT
  Fax TEXT
* Email TEXT NOT NULL
SupportRepId INTEGER
Foreign Key
FK_Customer Employee SupportRepId ↗ ❏ Employee(EmployeeId)
Referring Foreign Key
FK_Invoice Customer CustomerId ↙ ❏ Invoice


Table Employee
IdxColumn NameData Type
* EmployeeId INTEGER NOT NULL
* LastName TEXT NOT NULL
* FirstName TEXT NOT NULL
  Title TEXT
ReportsTo INTEGER
  BirthDate DATETIME
  HireDate DATETIME
  Address TEXT
  City TEXT
  State TEXT
  Country TEXT
  PostalCode TEXT
  Phone TEXT
  Fax TEXT
  Email TEXT
Foreign Key
FK_Employee Employee ReportsTo ↗ ❏ Employee(EmployeeId)
Referring Foreign Key
FK_Customer Employee EmployeeId ↙ ❏ Customer(SupportRepId)
FK_Employee Employee EmployeeId ↙ ❏ Employee(ReportsTo)


Table Genre
IdxColumn NameData Type
* GenreId INTEGER NOT NULL
  Name TEXT
Referring Foreign Key
FK_Track Genre GenreId ↙ ❏ Track


Table Invoice
IdxColumn NameData Type
* InvoiceId INTEGER NOT NULL
* CustomerId INTEGER NOT NULL
* InvoiceDate DATETIME NOT NULL
  BillingAddress TEXT
  BillingCity TEXT
  BillingState TEXT
  BillingCountry TEXT
  BillingPostalCode TEXT
* Total NUMERIC(10,2) NOT NULL
Foreign Key
FK_Invoice Customer CustomerId ↗ ❏ Customer
Referring Foreign Key
FK_InvoiceLine Invoice InvoiceId ↙ ❏ InvoiceLine


Table InvoiceLine
IdxColumn NameData Type
* InvoiceLineId INTEGER NOT NULL
* InvoiceId INTEGER NOT NULL
* TrackId INTEGER NOT NULL
* UnitPrice NUMERIC(10,2) NOT NULL
* Quantity INTEGER NOT NULL
Foreign Key
FK_InvoiceLine Invoice InvoiceId ↗ ❏ Invoice
FK_InvoiceLine Track TrackId ↗ ❏ Track


Table MediaType
IdxColumn NameData Type
* MediaTypeId INTEGER NOT NULL
  Name TEXT
Referring Foreign Key
FK_Track MediaType MediaTypeId ↙ ❏ Track


Table Playlist
IdxColumn NameData Type
* PlaylistId INTEGER NOT NULL
  Name TEXT
Referring Foreign Key
FK_PlaylistTrack Playlist PlaylistId ↙ ❏ PlaylistTrack


Table PlaylistTrack
IdxColumn NameData Type
* PlaylistId INTEGER NOT NULL
* TrackId INTEGER NOT NULL
Foreign Key
FK_PlaylistTrack Playlist PlaylistId ↗ ❏ Playlist
FK_PlaylistTrack Track TrackId ↗ ❏ Track


Table Track
IdxColumn NameData Type
* TrackId INTEGER NOT NULL
* Name TEXT NOT NULL
AlbumId INTEGER
* MediaTypeId INTEGER NOT NULL
GenreId INTEGER
  Composer TEXT
* Milliseconds INTEGER NOT NULL
  Bytes INTEGER
* UnitPrice NUMERIC(10,2) NOT NULL
Foreign Key
FK_Track Album AlbumId ↗ ❏ Album
FK_Track Genre GenreId ↗ ❏ Genre
FK_Track MediaType MediaTypeId ↗ ❏ MediaType
Referring Foreign Key
FK_InvoiceLine Track TrackId ↙ ❏ InvoiceLine
FK_PlaylistTrack Track TrackId ↙ ❏ PlaylistTrack