Question
CREATE TABLE customer ( id INTEGER PRIMARY KEY, customer_name TEXT, contact_number TEXT ); CREATE TABLE supplier ( id INTEGER PRIMARY KEY, supplier_name TEXT UNIQUE, contact_number
CREATE TABLE customer (
id INTEGER PRIMARY KEY,
customer_name TEXT,
contact_number TEXT
);
CREATE TABLE supplier (
id INTEGER PRIMARY KEY,
supplier_name TEXT UNIQUE,
contact_number TEXT
);
CREATE TABLE product (
id INTEGER PRIMARY KEY,
supplier_id INTEGER REFERENCES supplier(id),
product_name TEXT,
product_price INTEGER,
UNIQUE(supplier_id, product_name)
);
CREATE TABLE purchase (
id INTEGER PRIMARY KEY,
customer_id INTEGER REFERENCES customer(id),
purchase_date REAL,
store_id INTEGER REFERENCES store(id)
);
CREATE TABLE store (
id INTEGER PRIMARY KEY,
store_name TEXT,
store_address TEXT
);
CREATE TABLE purchase_product (
purchase_id INTEGER REFERENCES purchase(id),
product_id INTEGER REFERENCES product(id),
quantity INTEGER
);
-
List the names of all customers who have purchased a product that could have been purchased from a supplier with a lower price by at least 5 dollars
(500 cents), ordered by customer_name
-
List the names of all customers who purchased Tool 1717 and then later purchased O-Ring 1736, ordered by customer name.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started