CREATE TABLE IF NOT EXISTS suppliers ( supplier_id integer PRIMARY KEY, supplier_name text NOT NULL, group_id integer NOT NULL ); CREATE TABLE IF NOT EXISTS supplier_groups ( group_id integer PRIMARY KEY, group_name text NOT NULL );
DROP TABLE IF EXISTS suppliers; CREATE TABLE IF NOT EXISTS suppliers ( supplier_id integer PRIMARY KEY, supplier_name text NOT NULL, group_id integer NOT NULL, FOREIGN KEY (group_id) REFERENCES supplier_groups(group_id) );
INSERT INTO supplier_groups (group_name) VALUES ('Domestic'),('Global'),('One-Time');
INSERT INTO suppliers (supplier_name, group_id) VALUES ('HP', 2);
INSERT INTO suppliers (supplier_name, group_id) VALUES ('ABC Inc.', 4);
DROP TABLE suppliers; CREATE TABLE suppliers ( supplier_id integer PRIMARY KEY, supplier_name text NOT NULL, group_id integer, FOREIGN KEY (group_id) REFERENCES supplier_groups (group_id) ON UPDATE SET NULL );
INSERT INTO suppliers (supplier_name, group_id) VALUES ('XYZ Corp', 3); INSERT INTO suppliers (supplier_name, group_id) VALUES ('ABC Corp', 3);
UPDATE supplier_groups SET group_id = 300 WHERE group_name = 'One-Time';
SELECT * FROM suppliers;
SELECT * FROM albums;
SELECT * FROM artists;
SELECT * FROM customers;
SELECT * FROM employees;
SELECT * FROM genres;
SELECT * FROM invoice_items;
SELECT * FROM invoices;
SELECT * FROM media_types;
SELECT * FROM playlist_track;
SELECT * FROM playlists;
SELECT * FROM tracks;