USE mynorthwind;

CREATE TABLE IF NOT EXISTS invoices (
	invoiceId INT AUTO_INCREMENT PRIMARY KEY,
	customer VARCHAR(5) NOT NULL,
    amount INT NOT NULL,
    date DATE NOT NULL,
    FOREIGN KEY (customer) REFERENCES customers(CustomerID)
);

INSERT INTO invoices (customer, amount, date) VALUES ('ANATR', 250, '2026-01-06');
INSERT INTO invoices (customer, amount, date) VALUES ('ANTON', 375, '2026-01-02');
INSERT INTO invoices (customer, amount, date) VALUES ('ALFKI', 125, '2026-01-25');

CREATE TABLE IF NOT EXISTS returns (
	returnId INT AUTO_INCREMENT PRIMARY KEY,
    customer VARCHAR(5) NOT NULL,
    amount INT NOT NULL,
    date DATE NOT NULL,
    FOREIGN KEY (customer) REFERENCES customers(CustomerID)
);

INSERT INTO returns (customer, amount, date) VALUES ('ANATR', 111, '2026-02-12');
INSERT INTO returns (customer, amount, date) VALUES ('ANTON', 950, '2026-02-26');
INSERT INTO returns (customer, amount, date) VALUES ('ALFKI', 10205, '2026-03-01');