{"Album": {"columns": [[0, "AlbumId", "INTEGER", 1, null, 1], [1, "Title", "varchar(160)", 1, null, 0], [2, "ArtistId", "INTEGER", 1, null, 0]], "primary_keys": ["AlbumId"], "foreign_keys": [[0, 0, "Artist", "ArtistId", "ArtistId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Artist": {"columns": [[0, "ArtistId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["ArtistId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer": {"columns": [[0, "CustomerId", "INTEGER", 1, null, 1], [1, "FirstName", "varchar(40)", 1, null, 0], [2, "LastName", "varchar(20)", 1, null, 0], [3, "Company", "varchar(80)", 0, "NULL", 0], [4, "Address", "varchar(70)", 0, "NULL", 0], [5, "City", "varchar(40)", 0, "NULL", 0], [6, "State", "varchar(40)", 0, "NULL", 0], [7, "Country", "varchar(40)", 0, "NULL", 0], [8, "PostalCode", "varchar(10)", 0, "NULL", 0], [9, "Phone", "varchar(24)", 0, "NULL", 0], [10, "Fax", "varchar(24)", 0, "NULL", 0], [11, "Email", "varchar(60)", 1, null, 0], [12, "SupportRepId", "INTEGER", 0, "NULL", 0]], "primary_keys": ["CustomerId"], "foreign_keys": [[0, 0, "Employee", "SupportRepId", "EmployeeId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Employee": {"columns": [[0, "EmployeeId", "INTEGER", 1, null, 1], [1, "LastName", "varchar(20)", 1, null, 0], [2, "FirstName", "varchar(20)", 1, null, 0], [3, "Title", "varchar(30)", 0, "NULL", 0], [4, "ReportsTo", "INTEGER", 0, "NULL", 0], [5, "BirthDate", "datetime", 0, "NULL", 0], [6, "HireDate", "datetime", 0, "NULL", 0], [7, "Address", "varchar(70)", 0, "NULL", 0], [8, "City", "varchar(40)", 0, "NULL", 0], [9, "State", "varchar(40)", 0, "NULL", 0], [10, "Country", "varchar(40)", 0, "NULL", 0], [11, "PostalCode", "varchar(10)", 0, "NULL", 0], [12, "Phone", "varchar(24)", 0, "NULL", 0], [13, "Fax", "varchar(24)", 0, "NULL", 0], [14, "Email", "varchar(60)", 0, "NULL", 0]], "primary_keys": ["EmployeeId"], "foreign_keys": [[0, 0, "Employee", "ReportsTo", "EmployeeId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Genre": {"columns": [[0, "GenreId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["GenreId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Invoice": {"columns": [[0, "InvoiceId", "INTEGER", 1, null, 1], [1, "CustomerId", "INTEGER", 1, null, 0], [2, "InvoiceDate", "datetime", 1, null, 0], [3, "BillingAddress", "varchar(70)", 0, "NULL", 0], [4, "BillingCity", "varchar(40)", 0, "NULL", 0], [5, "BillingState", "varchar(40)", 0, "NULL", 0], [6, "BillingCountry", "varchar(40)", 0, "NULL", 0], [7, "BillingPostalCode", "varchar(10)", 0, "NULL", 0], [8, "Total", "decimal(10,2)", 1, null, 0]], "primary_keys": ["InvoiceId"], "foreign_keys": [[0, 0, "Customer", "CustomerId", "CustomerId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "InvoiceLine": {"columns": [[0, "InvoiceLineId", "INTEGER", 1, null, 1], [1, "InvoiceId", "INTEGER", 1, null, 0], [2, "TrackId", "INTEGER", 1, null, 0], [3, "UnitPrice", "decimal(10,2)", 1, null, 0], [4, "Quantity", "INTEGER", 1, null, 0]], "primary_keys": ["InvoiceLineId"], "foreign_keys": [[0, 0, "Track", "TrackId", "TrackId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Invoice", "InvoiceId", "InvoiceId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "MediaType": {"columns": [[0, "MediaTypeId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["MediaTypeId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Playlist": {"columns": [[0, "PlaylistId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["PlaylistId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "PlaylistTrack": {"columns": [[0, "PlaylistId", "INTEGER", 1, null, 1], [1, "TrackId", "INTEGER", 1, null, 2]], "primary_keys": ["PlaylistId", "TrackId"], "foreign_keys": [[0, 0, "Track", "TrackId", "TrackId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Playlist", "PlaylistId", "PlaylistId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "PlaylistId"], [1, 1, "TrackId"]]], "check_constraints": []}, "Track": {"columns": [[0, "TrackId", "INTEGER", 1, null, 1], [1, "Name", "varchar(200)", 1, null, 0], [2, "AlbumId", "INTEGER", 0, "NULL", 0], [3, "MediaTypeId", "INTEGER", 1, null, 0], [4, "GenreId", "INTEGER", 0, "NULL", 0], [5, "Composer", "varchar(220)", 0, "NULL", 0], [6, "Milliseconds", "INTEGER", 1, null, 0], [7, "Bytes", "INTEGER", 0, "NULL", 0], [8, "UnitPrice", "decimal(10,2)", 1, null, 0]], "primary_keys": ["TrackId"], "foreign_keys": [[0, 0, "MediaType", "MediaTypeId", "MediaTypeId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Genre", "GenreId", "GenreId", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Album", "AlbumId", "AlbumId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE Album (
    AlbumId INTEGER NOT NULL  PRIMARY KEY,
    Title varchar(160) NOT NULL,
    ArtistId INTEGER NOT NULL,
    FOREIGN KEY (ArtistId) REFERENCES Artist(ArtistId)
);

CREATE TABLE Artist (
    ArtistId INTEGER NOT NULL  PRIMARY KEY,
    Name varchar(120)  DEFAULT NULL
);

CREATE TABLE Customer (
    CustomerId INTEGER NOT NULL  PRIMARY KEY,
    FirstName varchar(40) NOT NULL,
    LastName varchar(20) NOT NULL,
    Company varchar(80)  DEFAULT NULL,
    Address varchar(70)  DEFAULT NULL,
    City varchar(40)  DEFAULT NULL,
    State varchar(40)  DEFAULT NULL,
    Country varchar(40)  DEFAULT NULL,
    PostalCode varchar(10)  DEFAULT NULL,
    Phone varchar(24)  DEFAULT NULL,
    Fax varchar(24)  DEFAULT NULL,
    Email varchar(60) NOT NULL,
    SupportRepId INTEGER  DEFAULT NULL,
    FOREIGN KEY (SupportRepId) REFERENCES Employee(EmployeeId)
);

CREATE TABLE Employee (
    EmployeeId INTEGER NOT NULL  PRIMARY KEY,
    LastName varchar(20) NOT NULL,
    FirstName varchar(20) NOT NULL,
    Title varchar(30)  DEFAULT NULL,
    ReportsTo INTEGER  DEFAULT NULL,
    BirthDate datetime  DEFAULT NULL,
    HireDate datetime  DEFAULT NULL,
    Address varchar(70)  DEFAULT NULL,
    City varchar(40)  DEFAULT NULL,
    State varchar(40)  DEFAULT NULL,
    Country varchar(40)  DEFAULT NULL,
    PostalCode varchar(10)  DEFAULT NULL,
    Phone varchar(24)  DEFAULT NULL,
    Fax varchar(24)  DEFAULT NULL,
    Email varchar(60)  DEFAULT NULL,
    FOREIGN KEY (ReportsTo) REFERENCES Employee(EmployeeId)
);

CREATE TABLE Genre (
    GenreId INTEGER NOT NULL  PRIMARY KEY,
    Name varchar(120)  DEFAULT NULL
);

CREATE TABLE Invoice (
    InvoiceId INTEGER NOT NULL  PRIMARY KEY,
    CustomerId INTEGER NOT NULL,
    InvoiceDate datetime NOT NULL,
    BillingAddress varchar(70)  DEFAULT NULL,
    BillingCity varchar(40)  DEFAULT NULL,
    BillingState varchar(40)  DEFAULT NULL,
    BillingCountry varchar(40)  DEFAULT NULL,
    BillingPostalCode varchar(10)  DEFAULT NULL,
    Total decimal(10,2) NOT NULL,
    FOREIGN KEY (CustomerId) REFERENCES Customer(CustomerId)
);

CREATE TABLE InvoiceLine (
    InvoiceLineId INTEGER NOT NULL  PRIMARY KEY,
    InvoiceId INTEGER NOT NULL,
    TrackId INTEGER NOT NULL,
    UnitPrice decimal(10,2) NOT NULL,
    Quantity INTEGER NOT NULL,
    FOREIGN KEY (TrackId) REFERENCES Track(TrackId),
    FOREIGN KEY (InvoiceId) REFERENCES Invoice(InvoiceId)
);

CREATE TABLE MediaType (
    MediaTypeId INTEGER NOT NULL  PRIMARY KEY,
    Name varchar(120)  DEFAULT NULL
);

CREATE TABLE Playlist (
    PlaylistId INTEGER NOT NULL  PRIMARY KEY,
    Name varchar(120)  DEFAULT NULL
);

CREATE TABLE PlaylistTrack (
    PlaylistId INTEGER NOT NULL  PRIMARY KEY,
    TrackId INTEGER NOT NULL  PRIMARY KEY,
    PRIMARY KEY (PlaylistId, TrackId),
    UNIQUE (PlaylistId, TrackId),
    FOREIGN KEY (TrackId) REFERENCES Track(TrackId),
    FOREIGN KEY (PlaylistId) REFERENCES Playlist(PlaylistId)
);

CREATE TABLE Track (
    TrackId INTEGER NOT NULL  PRIMARY KEY,
    Name varchar(200) NOT NULL,
    AlbumId INTEGER  DEFAULT NULL,
    MediaTypeId INTEGER NOT NULL,
    GenreId INTEGER  DEFAULT NULL,
    Composer varchar(220)  DEFAULT NULL,
    Milliseconds INTEGER NOT NULL,
    Bytes INTEGER  DEFAULT NULL,
    UnitPrice decimal(10,2) NOT NULL,
    FOREIGN KEY (MediaTypeId) REFERENCES MediaType(MediaTypeId),
    FOREIGN KEY (GenreId) REFERENCES Genre(GenreId),
    FOREIGN KEY (AlbumId) REFERENCES Album(AlbumId)
);