human
Schema:
Addresses (address_id, line_1_number_building, city, zip_postcode, state_province_county, country)
Staff (staff_id, staff_address_id, nickname, first_name, middle_name, last_name, date_of_birth, date_joined_staff, date_left_staff)
Vehicles (vehicle_id, vehicle_details)
Customers (customer_id, customer_address_id, customer_status_code, date_became_customer, date_of_birth, first_name, last_name, amount_outstanding, email_address, phone_number, cell_mobile_phone_number)
Customer_Payments (customer_id, datetime_payment, payment_method_code, amount_payment)
Lessons (lesson_id, customer_id, lesson_status_code, staff_id, vehicle_id, lesson_date, lesson_time, price)
Please answer with SQL.
assistant
Sure, I understand.
human
How many lessons taught by staff whose first name has letter 'a' in it?
assistant
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE '%a%'
human
What is the nickname of staff with first name as Janessa and last name as Sawayn?
assistant
SELECT nickname FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn';
human
How many staff in total?
assistant
SELECT count(*) FROM Staff;
human
How many staff have the first name Ludie?
assistant
SELECT count(*) FROM Staff WHERE first_name = 'Ludie';
human
Which last names are both used by customers and by staff?
assistant
SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
human
What are the first, middle, and last names of all staff?
assistant
SELECT first_name , middle_name , last_name FROM Staff ;