CREATE TABLE customer ( id TEXT PRIMARY KEY, name TEXT NOT NULL ); CREATE TABLE sales_order ( id TEXT PRIMARY KEY, order_number TEXT NOT NULL, order_date TIMESTAMP, customer_id TEXT NOT NULL REFERENCES customer, total_amount NUMERIC ); CREATE TABLE line_item ( id TEXT PRIMARY KEY, order_id TEXT NOT NULL REFERENCES sales_order, description TEXT NOT NULL, line_total NUMERIC NOT NULL ); INSERT INTO customer VALUES ('C1', 'John Doe'), ('C2', 'Juan Dela Cruz'); INSERT INTO sales_order VALUES ('O1', '001', '1996-07-08 00:00:00.0', 'C2', 123.45), ('O2', '002', NULL, 'C1', 5000);