SQL Schema Explorer by Tim Abell

sqlite-chinook

Database Diagram

Tap a table in the diagram to jump straight to it. Tap & drag in a gap to pan around. Tap & drag a table to re-arrange the diagram.

Tap the "enable zoom" button, then use the mouse wheel to zoom in to where the mouse pointer is.

Customised table layout is not remembered. Refresh the page to reset the diagram.

Tables

Name Rows Columns Fks Indexes
Album 347 3 1 2
Artist 275 2 1
Customer 59 13 1 2
Employee 8 15 1 2
Genre 25 2 1
Invoice 412 9 1 2
InvoiceLine 2240 5 2 3
MediaType 5 2 1
Playlist 18 2 1
PlaylistTrack 8715 2 2 2
Track 3503 9 3 4

Foreign Keys

From To
Album(ArtistId) Artist(ArtistId)
Customer(SupportRepId) Employee(EmployeeId)
Employee(ReportsTo) Employee(EmployeeId)
Invoice(CustomerId) Customer(CustomerId)
InvoiceLine(TrackId) Track(TrackId)
InvoiceLine(InvoiceId) Invoice(InvoiceId)
PlaylistTrack(TrackId) Track(TrackId)
PlaylistTrack(PlaylistId) Playlist(PlaylistId)
Track(MediaTypeId) MediaType(MediaTypeId)
Track(GenreId) Genre(GenreId)
Track(AlbumId) Album(AlbumId)

Indexes

Table Name Columns Unique
Album IFK_AlbumArtistId ArtistId
Album IPK_Album AlbumId Unique
Album IFK_AlbumArtistId ArtistId
Album IPK_Album AlbumId Unique
Artist IPK_Artist ArtistId Unique
Artist IPK_Artist ArtistId Unique
Customer IFK_CustomerSupportRepId SupportRepId
Customer IPK_Customer CustomerId Unique
Customer IFK_CustomerSupportRepId SupportRepId
Customer IPK_Customer CustomerId Unique
Employee IFK_EmployeeReportsTo ReportsTo
Employee IPK_Employee EmployeeId Unique
Employee IFK_EmployeeReportsTo ReportsTo
Employee IPK_Employee EmployeeId Unique
Genre IPK_Genre GenreId Unique
Genre IPK_Genre GenreId Unique
Invoice IFK_InvoiceCustomerId CustomerId
Invoice IPK_Invoice InvoiceId Unique
Invoice IFK_InvoiceCustomerId CustomerId
Invoice IPK_Invoice InvoiceId Unique
InvoiceLine IFK_InvoiceLineTrackId TrackId
InvoiceLine IFK_InvoiceLineInvoiceId InvoiceId
InvoiceLine IPK_InvoiceLine InvoiceLineId Unique
InvoiceLine IFK_InvoiceLineTrackId TrackId
InvoiceLine IFK_InvoiceLineInvoiceId InvoiceId
InvoiceLine IPK_InvoiceLine InvoiceLineId Unique
MediaType IPK_MediaType MediaTypeId Unique
MediaType IPK_MediaType MediaTypeId Unique
Playlist IPK_Playlist PlaylistId Unique
Playlist IPK_Playlist PlaylistId Unique
PlaylistTrack IFK_PlaylistTrackTrackId TrackId
PlaylistTrack IPK_PlaylistTrack PlaylistId,TrackId Unique
PlaylistTrack IFK_PlaylistTrackTrackId TrackId
PlaylistTrack IPK_PlaylistTrack PlaylistId,TrackId Unique
Track IFK_TrackMediaTypeId MediaTypeId
Track IFK_TrackGenreId GenreId
Track IFK_TrackAlbumId AlbumId
Track IPK_Track TrackId Unique
Track IFK_TrackMediaTypeId MediaTypeId
Track IFK_TrackGenreId GenreId
Track IFK_TrackAlbumId AlbumId
Track IPK_Track TrackId Unique

Columns

Table Name Type Primary Nulls Outbound Foreign Key Inbound Foreign Keys Indexes
Album AlbumId INTEGER Primary Key NOT NULL Track(AlbumId) IPK_Album
Album Title NVARCHAR(160) NOT NULL
Album ArtistId INTEGER NOT NULL Artist(ArtistId) IFK_AlbumArtistId
Artist ArtistId INTEGER Primary Key NOT NULL Album(ArtistId) IPK_Artist
Artist Name NVARCHAR(120) Nullable
Customer CustomerId INTEGER Primary Key NOT NULL Invoice(CustomerId) IPK_Customer
Customer FirstName NVARCHAR(40) NOT NULL
Customer LastName NVARCHAR(20) NOT NULL
Customer Company NVARCHAR(80) Nullable
Customer Address NVARCHAR(70) Nullable
Customer City NVARCHAR(40) Nullable
Customer State NVARCHAR(40) Nullable
Customer Country NVARCHAR(40) Nullable
Customer PostalCode NVARCHAR(10) Nullable
Customer Phone NVARCHAR(24) Nullable
Customer Fax NVARCHAR(24) Nullable
Customer Email NVARCHAR(60) NOT NULL
Customer SupportRepId INTEGER Nullable Employee(EmployeeId) IFK_CustomerSupportRepId
Employee EmployeeId INTEGER Primary Key NOT NULL Customer(SupportRepId) Employee(ReportsTo) IPK_Employee
Employee LastName NVARCHAR(20) NOT NULL
Employee FirstName NVARCHAR(20) NOT NULL
Employee Title NVARCHAR(30) Nullable
Employee ReportsTo INTEGER Nullable Employee(EmployeeId) IFK_EmployeeReportsTo
Employee BirthDate DATETIME Nullable
Employee HireDate DATETIME Nullable
Employee Address NVARCHAR(70) Nullable
Employee City NVARCHAR(40) Nullable
Employee State NVARCHAR(40) Nullable
Employee Country NVARCHAR(40) Nullable
Employee PostalCode NVARCHAR(10) Nullable
Employee Phone NVARCHAR(24) Nullable
Employee Fax NVARCHAR(24) Nullable
Employee Email NVARCHAR(60) Nullable
Genre GenreId INTEGER Primary Key NOT NULL Track(GenreId) IPK_Genre
Genre Name NVARCHAR(120) Nullable
Invoice InvoiceId INTEGER Primary Key NOT NULL InvoiceLine(InvoiceId) IPK_Invoice
Invoice CustomerId INTEGER NOT NULL Customer(CustomerId) IFK_InvoiceCustomerId
Invoice InvoiceDate DATETIME NOT NULL
Invoice BillingAddress NVARCHAR(70) Nullable
Invoice BillingCity NVARCHAR(40) Nullable
Invoice BillingState NVARCHAR(40) Nullable
Invoice BillingCountry NVARCHAR(40) Nullable
Invoice BillingPostalCode NVARCHAR(10) Nullable
Invoice Total NUMERIC(10,2) NOT NULL
InvoiceLine InvoiceLineId INTEGER Primary Key NOT NULL IPK_InvoiceLine
InvoiceLine InvoiceId INTEGER NOT NULL Invoice(InvoiceId) IFK_InvoiceLineInvoiceId
InvoiceLine TrackId INTEGER NOT NULL Track(TrackId) IFK_InvoiceLineTrackId
InvoiceLine UnitPrice NUMERIC(10,2) NOT NULL
InvoiceLine Quantity INTEGER NOT NULL
MediaType MediaTypeId INTEGER Primary Key NOT NULL Track(MediaTypeId) IPK_MediaType
MediaType Name NVARCHAR(120) Nullable
Playlist PlaylistId INTEGER Primary Key NOT NULL PlaylistTrack(PlaylistId) IPK_Playlist
Playlist Name NVARCHAR(120) Nullable
PlaylistTrack PlaylistId INTEGER Primary Key NOT NULL Playlist(PlaylistId) IPK_PlaylistTrack
PlaylistTrack TrackId INTEGER Primary Key NOT NULL Track(TrackId) IFK_PlaylistTrackTrackId IPK_PlaylistTrack
Track TrackId INTEGER Primary Key NOT NULL InvoiceLine(TrackId) PlaylistTrack(TrackId) IPK_Track
Track Name NVARCHAR(200) NOT NULL
Track AlbumId INTEGER Nullable Album(AlbumId) IFK_TrackAlbumId
Track MediaTypeId INTEGER NOT NULL MediaType(MediaTypeId) IFK_TrackMediaTypeId
Track GenreId INTEGER Nullable Genre(GenreId) IFK_TrackGenreId
Track Composer NVARCHAR(220) Nullable
Track Milliseconds INTEGER NOT NULL
Track Bytes INTEGER Nullable
Track UnitPrice NUMERIC(10,2) NOT NULL
^ top