nl
stringlengths
22
185
sql
stringlengths
22
608
db_id
stringclasses
40 values
table_schema
stringclasses
305 values
What are all meeting types and other details?
SELECT meeting_type , other_details FROM meetings
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
Show all meeting outcomes and purposes.
SELECT meeting_outcome , purpose_of_meeting FROM meetings
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
What are all meeting outcomes and purposes?
SELECT meeting_outcome , purpose_of_meeting FROM meetings
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
Show all payment ids and details for invoices whose status is 'Working'.
SELECT T1.payment_id , T1.payment_details FROM Payments AS T1 JOIN Invoices AS T2 ON T1.invoice_id = T2.invoice_id WHERE T2.invoice_status = 'Working'
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
What are all payment ids and payment details for invoices with status Working?
SELECT T1.payment_id , T1.payment_details FROM Payments AS T1 JOIN Invoices AS T2 ON T1.invoice_id = T2.invoice_id WHERE T2.invoice_status = 'Working'
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
Show all invoice ids and statuses without a payment.
SELECT invoice_id , invoice_status FROM Invoices EXCEPT SELECT T1.invoice_id , T1.invoice_status FROM Invoices AS T1 JOIN Payments AS T2 ON T1.invoice_id = T2.invoice_id
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
What are the invoice ids and statuses for invoices without a payment?
SELECT invoice_id , invoice_status FROM Invoices EXCEPT SELECT T1.invoice_id , T1.invoice_status FROM Invoices AS T1 JOIN Payments AS T2 ON T1.invoice_id = T2.invoice_id
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
How many payments do we have?
SELECT count(*) FROM Payments
advertising_agencies
[{'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name': 'invoice id'}, {'col_name': 'payment details'}], 'foreign_key_columns': ['invoice id'], 'primary_keys': []}]
Count the number of payments.
SELECT count(*) FROM Payments
advertising_agencies
[{'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name': 'invoice id'}, {'col_name': 'payment details'}], 'foreign_key_columns': ['invoice id'], 'primary_keys': []}]
List all payment ids and its corresponding invoice ids and details.
SELECT payment_id , invoice_id , payment_details FROM Payments
advertising_agencies
[{'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name': 'invoice id'}, {'col_name': 'payment details'}], 'foreign_key_columns': ['invoice id'], 'primary_keys': []}]
What are the payment ids, invoice ids, and payment details for all payments?
SELECT payment_id , invoice_id , payment_details FROM Payments
advertising_agencies
[{'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name': 'invoice id'}, {'col_name': 'payment details'}], 'foreign_key_columns': ['invoice id'], 'primary_keys': []}]
Show all the different invoice ids and statuses of the payments
SELECT DISTINCT T1.invoice_id , T1.invoice_status FROM Invoices AS T1 JOIN Payments AS T2 ON T1.invoice_id = T2.invoice_id
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
What are the distinct invoice ids and statuses for all payments?
SELECT DISTINCT T1.invoice_id , T1.invoice_status FROM Invoices AS T1 JOIN Payments AS T2 ON T1.invoice_id = T2.invoice_id
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
Show all invoice ids and the number of payments for each invoice.
SELECT invoice_id , count(*) FROM Payments GROUP BY invoice_id
advertising_agencies
[{'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name': 'invoice id'}, {'col_name': 'payment details'}], 'foreign_key_columns': ['invoice id'], 'primary_keys': []}]
How many payments are there for each invoice?
SELECT invoice_id , count(*) FROM Payments GROUP BY invoice_id
advertising_agencies
[{'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name': 'invoice id'}, {'col_name': 'payment details'}], 'foreign_key_columns': ['invoice id'], 'primary_keys': []}]
What is the invoice id, status code, and details for the invoice with most number of payments.
SELECT T1.invoice_id , T2.invoice_status , T2.invoice_details FROM Payments AS T1 JOIN Invoices AS T2 ON T1.invoice_id = T2.invoice_id GROUP BY T1.invoice_id ORDER BY count(*) DESC LIMIT 1
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
Return the invoice ids, statuses, and details for invoices with the most payments?
SELECT T1.invoice_id , T2.invoice_status , T2.invoice_details FROM Payments AS T1 JOIN Invoices AS T2 ON T1.invoice_id = T2.invoice_id GROUP BY T1.invoice_id ORDER BY count(*) DESC LIMIT 1
advertising_agencies
[{'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client id'}, {'col_name': 'invoice status'}, {'col_name': 'invoice details'}], 'foreign_key_columns': ['client id'], 'primary_keys': ['invoice id']}, {'table_name': 'payments', 'table_schema': [{'col_name': 'payment id'}, {'col_name'...
How many staff do we have?
SELECT count(*) FROM Staff
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
Count the number of staff.
SELECT count(*) FROM Staff
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
Show the agency ids and the number of staff in each agent?
SELECT agency_id , count(*) FROM Staff GROUP BY agency_id
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
Return the agency ids and number of staff in each.
SELECT agency_id , count(*) FROM Staff GROUP BY agency_id
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
What is the agent id and details for the agency with most staff?
SELECT T1.agency_id , T2.agency_details FROM Staff AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id GROUP BY T1.agency_id ORDER BY count(*) DESC LIMIT 1
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'pr...
Return the id and detail for the agency with the most staff.
SELECT T1.agency_id , T2.agency_details FROM Staff AS T1 JOIN Agencies AS T2 ON T1.agency_id = T2.agency_id GROUP BY T1.agency_id ORDER BY count(*) DESC LIMIT 1
advertising_agencies
[{'table_name': 'agencies', 'table_schema': [{'col_name': 'agency id'}, {'col_name': 'agency details'}], 'foreign_key_columns': [], 'primary_keys': ['agency id']}, {'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'pr...
Show meeting outcome codes and the number of meeting in each outcome.
SELECT meeting_outcome , count(*) FROM Meetings GROUP BY meeting_outcome
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
How many meetings had each meeting outcome?
SELECT meeting_outcome , count(*) FROM Meetings GROUP BY meeting_outcome
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
List the client ids and the number of meeting for each client.
SELECT client_id , count(*) FROM Meetings GROUP BY client_id
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
How many meetings are there for each client id?
SELECT client_id , count(*) FROM Meetings GROUP BY client_id
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
Show the meeting type codes and the number of meeting for each client.
SELECT meeting_type , count(*) FROM Meetings GROUP BY meeting_type
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
How many meetings are there for each meeting type?
SELECT meeting_type , count(*) FROM Meetings GROUP BY meeting_type
advertising_agencies
[{'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client id'}, {'col_name': 'meeting outcome'}, {'col_name': 'meeting type'}, {'col_name': 'billable yn'}, {'col_name': 'start date time'}, {'col_name': 'end date time'}, {'col_name': 'purpose of meeting'}, {'col_name': 'other details'...
Show all meeting ids, meeting outcomes, meeting types and the details of the client atttending it.
SELECT T1.meeting_id , T1.meeting_outcome , T1.meeting_type , T2.client_details FROM meetings AS T1 JOIN clients AS T2 ON T1.client_id = T2.client_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client ...
What are the meeting ids, meeting outcomes, meeting types, and client details for all meetings?
SELECT T1.meeting_id , T1.meeting_outcome , T1.meeting_type , T2.client_details FROM meetings AS T1 JOIN clients AS T2 ON T1.client_id = T2.client_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'client ...
Show the meeting ids and the number of staff in each meeting.
SELECT meeting_id , count(*) FROM Staff_in_meetings GROUP BY meeting_id
advertising_agencies
[{'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['staff id', 'meeting id'], 'primary_keys': []}]
Count the number of staff in each meeting by meeting id.
SELECT meeting_id , count(*) FROM Staff_in_meetings GROUP BY meeting_id
advertising_agencies
[{'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['staff id', 'meeting id'], 'primary_keys': []}]
Show the staff id and the number of meetings attended by the staff who attended some meeting but had the lowest attendance.
SELECT staff_id , count(*) FROM Staff_in_meetings GROUP BY staff_id ORDER BY count(*) ASC LIMIT 1;
advertising_agencies
[{'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['staff id', 'meeting id'], 'primary_keys': []}]
What is the staff id of the staff who attended the least meetings but attended some meeting?
SELECT staff_id , count(*) FROM Staff_in_meetings GROUP BY staff_id ORDER BY count(*) ASC LIMIT 1;
advertising_agencies
[{'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['staff id', 'meeting id'], 'primary_keys': []}]
How many staff have attended a meeting?
SELECT count(DISTINCT staff_id) FROM Staff_in_meetings
advertising_agencies
[{'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['staff id', 'meeting id'], 'primary_keys': []}]
Return the number of distinct staff who have attended a meeting?
SELECT count(DISTINCT staff_id) FROM Staff_in_meetings
advertising_agencies
[{'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['staff id', 'meeting id'], 'primary_keys': []}]
How many staff did not attend any meeting?
SELECT count(*) FROM Staff WHERE staff_id NOT IN ( SELECT staff_id FROM Staff_in_meetings )
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}, {'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['st...
Count the number of staff who did not attend any meeting.
SELECT count(*) FROM Staff WHERE staff_id NOT IN ( SELECT staff_id FROM Staff_in_meetings )
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}, {'table_name': 'staff in meetings', 'table_schema': [{'col_name': 'meeting id'}, {'col_name': 'staff id'}], 'foreign_key_columns': ['st...
What are the ids and details of the clients who have attended any meeting or have any invoice?
SELECT T1.client_id , T1.client_details FROM Clients AS T1 JOIN meetings AS T2 ON T1.client_id = T2.client_id UNION SELECT T1.client_id , T1.client_details FROM Clients AS T1 JOIN invoices AS T2 ON T1.client_id = T2.client_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client ...
Return the ids and details of clients who have attended a meeting or had an invoice.
SELECT T1.client_id , T1.client_details FROM Clients AS T1 JOIN meetings AS T2 ON T1.client_id = T2.client_id UNION SELECT T1.client_id , T1.client_details FROM Clients AS T1 JOIN invoices AS T2 ON T1.client_id = T2.client_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client ...
What are the ids and details of the staff who have attended at least 1 meetings and have the detail with letter 's'?
SELECT staff_id , staff_details FROM staff WHERE staff_details LIKE "%s%" GROUP BY staff_id HAVING count(*) >= 1
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
Return the ids and details of staff who have attended at least 1 meeting and have an s in their staff details?
SELECT staff_id , staff_details FROM staff WHERE staff_details LIKE "%s%" GROUP BY staff_id HAVING count(*) >= 1
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}]
What are the id, sic code and agency id of the client who has attended 1 meeting and has any invoice.
SELECT T1.client_id , T1.sic_code , T1.agency_id FROM clients AS T1 JOIN meetings AS T2 ON T1.client_id = T2.client_id GROUP BY T1.client_id HAVING count(*) = 1 INTERSECT SELECT T1.client_id , T1.sic_code , T1.agency_id FROM clients AS T1 JOIN invoices AS T2 ON T1.client_id = T2.client_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client ...
Return the ids, sic codes, and agency ids of clients who have attended 1 meeting and had an invoice.
SELECT T1.client_id , T1.sic_code , T1.agency_id FROM clients AS T1 JOIN meetings AS T2 ON T1.client_id = T2.client_id GROUP BY T1.client_id HAVING count(*) = 1 INTERSECT SELECT T1.client_id , T1.sic_code , T1.agency_id FROM clients AS T1 JOIN invoices AS T2 ON T1.client_id = T2.client_id
advertising_agencies
[{'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name': 'client details'}], 'foreign_key_columns': ['agency id'], 'primary_keys': ['client id']}, {'table_name': 'invoices', 'table_schema': [{'col_name': 'invoice id'}, {'col_name': 'client ...
List the start time, end time of each meeting, and the corresponding client detail and staff detail.
SELECT T1.start_date_time , T1.end_date_time , T2.client_details , T4.staff_details FROM meetings AS T1 JOIN clients AS T2 ON T1.client_id = T2.client_id JOIN staff_in_meetings AS T3 ON T1.meeting_id = T3.meeting_id JOIN staff AS T4 ON T3.staff_id = T4.staff_id
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name':...
What are the start and end times of each meeting, as well as the corresponding client and staff details the attendees?
SELECT T1.start_date_time , T1.end_date_time , T2.client_details , T4.staff_details FROM meetings AS T1 JOIN clients AS T2 ON T1.client_id = T2.client_id JOIN staff_in_meetings AS T3 ON T1.meeting_id = T3.meeting_id JOIN staff AS T4 ON T3.staff_id = T4.staff_id
advertising_agencies
[{'table_name': 'staff', 'table_schema': [{'col_name': 'staff id'}, {'col_name': 'agency id'}, {'col_name': 'staff details'}], 'foreign_key_columns': [], 'primary_keys': ['staff id']}, {'table_name': 'clients', 'table_schema': [{'col_name': 'client id'}, {'col_name': 'agency id'}, {'col_name': 'sic code'}, {'col_name':...