SELECT name FROM media_types;
List all media types.
CREATE TABLE artists
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(120)
);
CREATE TABLE albums
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    title VARCHAR(160)  NOT NULL,
    artist_id INTEGER  NOT NULL,
    FOREIGN KEY (artist_id) REFERENCES artists (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE employees
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    last_name VARCHAR(20)  NOT NULL,
    first_name VARCHAR(20)  NOT NULL,
    title VARCHAR(30),
    reports_to INTEGER,
    birth_date TIMESTAMP,
    hire_date TIMESTAMP,
    address VARCHAR(70),
    city VARCHAR(40),
    state VARCHAR(40),
    country VARCHAR(40),
    postal_code VARCHAR(10),
    phone VARCHAR(24),
    fax VARCHAR(24),
    email VARCHAR(60),
    FOREIGN KEY (reports_to) REFERENCES employees (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE customers
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    first_name VARCHAR(40)  NOT NULL,
    last_name VARCHAR(20)  NOT NULL,
    company VARCHAR(80),
    address VARCHAR(70),
    city VARCHAR(40),
    state VARCHAR(40),
    country VARCHAR(40),
    postal_code VARCHAR(10),
    phone VARCHAR(24),
    fax VARCHAR(24),
    email VARCHAR(60)  NOT NULL,
    support_rep_id INTEGER,
    FOREIGN KEY (support_rep_id) REFERENCES employees (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE genres
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(120)
);
CREATE TABLE invoices
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    customer_id INTEGER  NOT NULL,
    invoice_date TIMESTAMP  NOT NULL,
    billing_address VARCHAR(70),
    billing_city VARCHAR(40),
    billing_state VARCHAR(40),
    billing_country VARCHAR(40),
    billing_postal_code VARCHAR(10),
    total NUMERIC(10,2)  NOT NULL,
    FOREIGN KEY (customer_id) REFERENCES customers (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE media_types
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(120)
);
CREATE TABLE tracks
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(200)  NOT NULL,
    album_id INTEGER,
    media_type_id INTEGER  NOT NULL,
    genre_id INTEGER,
    composer VARCHAR(220),
    milliseconds INTEGER  NOT NULL,
    bytes INTEGER,
    unit_price NUMERIC(10,2)  NOT NULL,
    FOREIGN KEY (album_id) REFERENCES albums (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
    FOREIGN KEY (genre_id) REFERENCES genres (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
    FOREIGN KEY (media_type_id) REFERENCES media_types (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE invoice_lines
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    invoice_id INTEGER  NOT NULL,
    track_id INTEGER  NOT NULL,
    unit_price NUMERIC(10,2)  NOT NULL,
    quantity INTEGER  NOT NULL,
    FOREIGN KEY (invoice_id) REFERENCES invoices (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
    FOREIGN KEY (track_id) REFERENCES tracks (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE playlists
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(120)
);
CREATE TABLE playlist_tracks
(
    playlist_id INTEGER  NOT NULL,
    track_id INTEGER  NOT NULL,
    CONSTRAINT PK_PlaylistTrack PRIMARY KEY  (playlist_id, track_id),
    FOREIGN KEY (playlist_id) REFERENCES playlists (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
    FOREIGN KEY (track_id) REFERENCES tracks (id)
    ON DELETE NO ACTION ON UPDATE NO ACTION
);
INSERT INTO genres (name) VALUES ('Rock');
INSERT INTO media_types (name) VALUES ('MPEG audio file');
INSERT INTO artists (name) VALUES ('AC/DC');
INSERT INTO albums (title, artist_id) VALUES ('For Those About To Rock We Salute You', 1);
INSERT INTO tracks (name, album_id, media_type_id, genre_id, composer, milliseconds, bytes, unit_price) VALUES ('For Those About To Rock (We Salute You)', 1, 1, 1, 'Angus Young, Malcolm Young, Brian Johnson', 343719, 11170334, 0.99);
INSERT INTO employees (last_name, first_name, title, birth_date, hire_date, address, city, state, country, postal_code, phone, fax, email) VALUES ('Adams', 'Andrew', 'General Manager', '1962-02-18 00:00:00', '2002-08-14 00:00:00', '11120 Jasper Ave NW', 'Edmonton', 'AB', 'Canada', 'T5K 2N1', '+1 (780) 428-9482', '+1 (780) 428-3457', 'andrew@chinookcorp.com');
INSERT INTO customers (first_name, last_name, company, address, city, state, country, postal_code, phone, fax, email, support_rep_id) VALUES ('Luís', 'Gonçalves', 'Embraer - Empresa Brasileira de Aeronáutica S.A.', 'Av. Brigadeiro Faria Lima, 2170', 'São José dos Campos', 'SP', 'Brazil', '12227-000', '+55 (12) 3923-5555', '+55 (12) 3923-5566', 'luisg@embraer.com.br', 3);
INSERT INTO invoices (customer_id, invoice_date, billing_address, billing_city, billing_country, billing_postal_code, total) VALUES (2, '2007-01-01 00:00:00', 'Theodor-Heuss-Straße 34', 'Stuttgart', 'Germany', '70174', 1.98);
INSERT INTO invoice_lines (invoice_id, track_id, unit_price, quantity) VALUES (1, 2, 0.99, 1);
INSERT INTO playlists (name) VALUES ('Music');
INSERT INTO playlist_tracks (playlist_id, track_id) VALUES (1, 3402);