
CREATE TABLE "Complaints" (
	complaint_id INTEGER NOT NULL, 
	product_id INTEGER NOT NULL, 
	customer_id INTEGER NOT NULL, 
	complaint_outcome_code VARCHAR(20) NOT NULL, 
	complaint_status_code VARCHAR(20) NOT NULL, 
	complaint_type_code VARCHAR(20) NOT NULL, 
	date_complaint_raised DATETIME, 
	date_complaint_closed DATETIME, 
	staff_id INTEGER NOT NULL, 
	FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), 
	FOREIGN KEY(product_id) REFERENCES "Products" (product_id), 
	FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id)
)


CREATE TABLE "Customers" (
	customer_id INTEGER, 
	customer_type_code VARCHAR(20) NOT NULL, 
	address_line_1 VARCHAR(80), 
	address_line_2 VARCHAR(80), 
	town_city VARCHAR(80), 
	state VARCHAR(80), 
	email_address VARCHAR(255), 
	phone_number VARCHAR(80), 
	PRIMARY KEY (customer_id)
)


CREATE TABLE "Products" (
	product_id INTEGER, 
	parent_product_id INTEGER, 
	product_category_code VARCHAR(20) NOT NULL, 
	date_product_first_available DATETIME, 
	date_product_discontinued DATETIME, 
	product_name VARCHAR(80), 
	product_description VARCHAR(255), 
	product_price DECIMAL(19, 4), 
	PRIMARY KEY (product_id)
)


CREATE TABLE "Staff" (
	staff_id INTEGER, 
	gender VARCHAR(1), 
	first_name VARCHAR(80), 
	last_name VARCHAR(80), 
	email_address VARCHAR(255), 
	phone_number VARCHAR(80), 
	PRIMARY KEY (staff_id)
)

CREATE TABLE "Complaints" (
	complaint_id INTEGER NOT NULL, 
	product_id INTEGER NOT NULL, 
	customer_id INTEGER NOT NULL, 
	complaint_outcome_code VARCHAR(20) NOT NULL, 
	complaint_status_code VARCHAR(20) NOT NULL, 
	complaint_type_code VARCHAR(20) NOT NULL, 
	date_complaint_raised DATETIME, 
	date_complaint_closed DATETIME, 
	staff_id INTEGER NOT NULL, 
	FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), 
	FOREIGN KEY(product_id) REFERENCES "Products" (product_id), 
	FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id)
)

/*
2 rows from Complaints table:
complaint_id	product_id	customer_id	complaint_outcome_code	complaint_status_code	complaint_type_code	date_complaint_raised	date_complaint_closed	staff_id
1	117	120	OK	Closed	Product Failure	2002-07-18 10:59:35	1976-04-19 11:03:06	114
2	118	113	OK	New	Product Unusable	1973-02-10 22:55:56	2013-09-14 02:59:10	120
*/


CREATE TABLE "Customers" (
	customer_id INTEGER, 
	customer_type_code VARCHAR(20) NOT NULL, 
	address_line_1 VARCHAR(80), 
	address_line_2 VARCHAR(80), 
	town_city VARCHAR(80), 
	state VARCHAR(80), 
	email_address VARCHAR(255), 
	phone_number VARCHAR(80), 
	PRIMARY KEY (customer_id)
)

/*
2 rows from Customers table:
customer_id	customer_type_code	address_line_1	address_line_2	town_city	state	email_address	phone_number
113	Good Credit Rating	144 Legros Landing	Apt. 551	Maryamport	Kansas	hsteuber@example.org	06963347450
114	Good Credit Rating	039 Jedidiah Estate Suite 537	Apt. 245	Sauerberg	Hawaii	cayla.satterfield@example.net	470-803-0244
*/


CREATE TABLE "Products" (
	product_id INTEGER, 
	parent_product_id INTEGER, 
	product_category_code VARCHAR(20) NOT NULL, 
	date_product_first_available DATETIME, 
	date_product_discontinued DATETIME, 
	product_name VARCHAR(80), 
	product_description VARCHAR(255), 
	product_price DECIMAL(19, 4), 
	PRIMARY KEY (product_id)
)

/*
2 rows from Products table:
product_id	parent_product_id	product_category_code	date_product_first_available	date_product_discontinued	product_name	product_description	product_price
117	4	Food	1988-09-29 17:54:50	1987-12-20 13:46:16	Chocolate	Handmade chocolate	2.8800
118	3	Book	1974-06-25 12:26:47	1991-08-20 05:22:31	The Great Gatsby	American novel	35.0000
*/


CREATE TABLE "Staff" (
	staff_id INTEGER, 
	gender VARCHAR(1), 
	first_name VARCHAR(80), 
	last_name VARCHAR(80), 
	email_address VARCHAR(255), 
	phone_number VARCHAR(80), 
	PRIMARY KEY (staff_id)
)

/*
2 rows from Staff table:
staff_id	gender	first_name	last_name	email_address	phone_number
114	0	Ward	Boehm	marcelle.ritchie@example.com	(379)551-0838x146
115	1	Lucie	Lowe	ohintz@example.org	142-311-6503x206
*/
What is the last name of the staff member in charge of the complaint on the product with the lowest price?
SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id  =  t2.staff_id JOIN products AS t3 ON t2.product_id  =  t3.product_id ORDER BY t3.product_price LIMIT 1
[{'last_name': 'Boehm'}]