context
stringlengths 11
9.12k
| question
stringlengths 0
1.06k
| SQL
stringlengths 2
4.44k
| source
stringclasses 28
values |
---|---|---|---|
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Indicate the start date of patient Walter Bahringer's care plan. | SELECT DISTINCT T2.start FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Walter' AND T1.last = 'Bahringer' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Describe the care plans of patient Major D'Amore's plan of care. | SELECT DISTINCT T2.DESCRIPTION FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Major' AND T1.last = 'D''Amore' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Calculate the percentage of male patients with viral sinusitis condition. | SELECT CAST(SUM(CASE WHEN T1.gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Viral sinusitis (disorder)' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Among the patients who have been using Penicillin V Potassium 250 MG, what percentage of patients are female? | SELECT CAST(SUM(CASE WHEN T1.gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Penicillin V Potassium 250 MG' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Among the white patients, what is the average body height of the patients? | SELECT AVG(T1.VALUE) FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.race = 'white' AND T1.DESCRIPTION = 'Body Height' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Indicate the care plan needed for the patient living at 179 Sydni Roads, Taunton, MA 02780 US. | SELECT T1.DESCRIPTION FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.address = '179 Sydni Roads Taunton MA 02780 US' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Provide the allergen of the Dominican patient named Dirk Languish. | SELECT T1.DESCRIPTION FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.first = 'Dirk' AND T2.last = 'Langosh' AND T2.ethnicity = 'dominican' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | How many patients who are allergic to peanuts have asthma? | SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN allergies AS T3 ON T2.patient = T3.PATIENT WHERE T1.DESCRIPTION = 'Asthma' AND T3.DESCRIPTION = 'Allergy to peanuts' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Who is the 44-year-old patient diagnosed with drug overdose? | SELECT T2.first, T2.last FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Drug overdose' AND ROUND((strftime('%J', T2.deathdate) - strftime('%J', T2.birthdate)) / 365) = 44 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Provide the social security number of the patient with the highest systolic blood pressure. | SELECT T2.ssn FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Systolic Blood Pressure' ORDER BY T1.VALUE DESC LIMIT 1 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | What is the care plan description of the prevalent disease with the highest prevalence percentage? | SELECT T4.DESCRIPTION FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON T2.DESCRIPTION = T1.ITEM INNER JOIN encounters AS T3 ON T2.ENCOUNTER = T3.ID INNER JOIN careplans AS T4 ON T4.ENCOUNTER = T3.ID ORDER BY T1."PREVALENCE PERCENTAGE" DESC LIMIT 1 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | What is the care plan for the patient with social security number 999-15-3685? | SELECT DISTINCT T1.DESCRIPTION FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.ssn = '999-15-3685' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Calculate the average age of the male patients that have hypertension. | SELECT SUM(CASE WHEN T2.deathdate IS NULL THEN ROUND((strftime('%J', date('now')) - strftime('%J', T2.birthdate)) / 365) ELSE ROUND((strftime('%J', T2.deathdate) - strftime('%J', T2.birthdate)) / 365) END) / COUNT(T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Hypertension' AND T2.gender = 'M' | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | List 5 patients' name that need medication due to streptococcal sore throat disorder. | SELECT DISTINCT T2.first, T2.last FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.REASONDESCRIPTION = 'Streptococcal sore throat (disorder)' LIMIT 5 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Who is the patient with a body weight of 61.97 kg? | SELECT T2.first, T2.last FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Body Weight' AND T1.UNITS = 'kg' AND T1.VALUE = 61.97 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | Among the male patients, list down 5 birth dates of patients taking the medication "Penicillin V Potassium 250 MG". | SELECT DISTINCT T2.birthdate FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Penicillin V Potassium 250 MG' AND T2.gender = 'M' LIMIT 5 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | List down the full name of Irish patients diagnosed with the prevalent diseases that have an occurrence greater than the 96% of the average occurrences of all conditions. | SELECT DISTINCT T2.first, T2.last FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN all_prevalences AS T3 ON T1.DESCRIPTION = T3.ITEM WHERE T2.ethnicity = 'irish' AND 100 * CAST(T3.OCCURRENCES AS REAL) / ( SELECT AVG(OCCURRENCES) FROM all_prevalences ) > 96 | bird |
CREATE TABLE synthea (ITEM text, POPULATION TYPE text, OCCURRENCES integer, POPULATION COUNT integer, PREVALENCE RATE real, PREVALENCE PERCENTAGE real, patient text, birthdate date, deathdate date, ssn text, drivers text, passport text, prefix text, first text, last text, suffix text, maiden text, marital text, race text, ethnicity text, gender text, birthplace text, address text, ID text, DATE date, PATIENT text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START text, STOP text, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, ID text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE real, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, START date, STOP date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, DATE date, PATIENT text, ENCOUNTER text, CODE text, DESCRIPTION text, VALUE real, UNITS text, DATE date, PATIENT text, ENCOUNTER text, CODE integer, DESCRIPTION text, REASONCODE integer, REASONDESCRIPTION text, ID text, PATIENT text, BILLABLEPERIOD date, ORGANIZATION text, ENCOUNTER text, DIAGNOSIS text, TOTAL integer) | What is the difference between the number of married patients and the number of single patients with diabetes? | SELECT SUM(CASE WHEN T2.marital = 'M' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.marital = 'S' THEN 1 ELSE 0 END) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Diabetes' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | List the country and how many customers are there. | SELECT country, COUNT(customerNumber) FROM customers GROUP BY country | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Which different vendor has the most amount of orders? Calculate the total estimated earnings. | SELECT DISTINCT T1.productVendor, T1.MSRP - T1.buyPrice FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode GROUP BY T1.productVendor, T1.MSRP, T1.buyPrice ORDER BY COUNT(T2.quantityOrdered) DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Who is the sales agent of the distinct customer who paid the highest amount in the year 2004? | SELECT DISTINCT T3.lastName, T3.firstName FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber INNER JOIN employees AS T3 ON T2.salesRepEmployeeNumber = T3.employeeNumber WHERE STRFTIME('%Y', T1.paymentDate) = '2004' ORDER BY T1.amount DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What was the total price of the products shipped to Rovelli Gifts Distributors Ltd. between 1/1/2003 and 12/31/2003? | SELECT T3.priceEach * T3.quantityOrdered FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber INNER JOIN orderdetails AS T3 ON T2.orderNumber = T3.orderNumber WHERE T1.customerName = 'Rovelli Gifts' AND T2.status = 'Shipped' AND STRFTIME('%Y', T2.shippedDate) = '2003' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many employees are there in Sydney? | SELECT COUNT(employeeNumber) FROM employees WHERE officeCode = ( SELECT officeCode FROM offices WHERE city = 'Sydney' ) | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Which sales representatives in New York city whose leader is Anthony Bow with the employee number is 1143? Indicate their employee numbers. | SELECT T1.employeeNumber FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.reportsTo = 1143 AND T2.city = 'NYC' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the average, highest and lowest annual payments collected between 1/1/2003 to 12/31/2005? | SELECT CAST(SUM(T1.amount) AS REAL) / 3, MAX(T1.amount) , MIN(T1.amount) FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.paymentDate BETWEEN '2003-01-01' AND '2005-12-31' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Which countries do the top 5 highest paying customers in a single payment come from? Indicate their entire address. | SELECT DISTINCT T2.country, T2.addressLine1, T2.addressLine2 FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber ORDER BY T1.amount DESC LIMIT 5 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many checks were issued by Euro+ Shopping Channel in the year 2004? | SELECT COUNT(T1.checkNumber) FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE customerName = 'Euro+ Shopping Channel' AND STRFTIME('%Y', T1.paymentDate) = '2004' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Of all the classic cars, with a product scale of 1:18, which product is the most ordered product by customers? | SELECT T1.productName FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode WHERE T1.productScale = '1:18' AND T1.productLine = 'Classic Cars' GROUP BY T1.productName ORDER BY SUM(T2.quantityOrdered) DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many customers have a credit limit of not more than 100,000 and which customer made the highest total payment amount for the year 2004? | SELECT ( SELECT COUNT(customerNumber) FROM customers WHERE creditLimit <= 100000 AND customerNumber IN ( SELECT customerNumber FROM payments WHERE STRFTIME('%Y', paymentDate) = '2004' ) ), T1.customerName FROM customers AS T1 INNER JOIN payments AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.creditLimit <= 100000 AND STRFTIME('%Y', T2.paymentDate) = '2004' GROUP BY T1.customerNumber, T1.customerName ORDER BY SUM(T2.amount) DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Which of the customers, whose Tokyo-based sales representative reports to the Vice President of Sales whose employee number is 1056, has paid the highest payment? List the customer's name, the contact person and calculate the total amount of that customer's total payments. | SELECT T2.customerName, T2.contactFirstName, T2.contactLastName, SUM(T3.amount) FROM employees AS T1 INNER JOIN customers AS T2 ON T2.salesRepEmployeeNumber = T1.employeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN offices AS T4 ON T1.officeCode = T4.officeCode WHERE T4.city = 'Tokyo' AND T1.reportsTo = 1056 GROUP BY T2.customerName, T2.contactFirstName, T2.contactLastName ORDER BY amount DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Which two products has the highest and lowest expected profits? Determine the total price for each product in terms of the largest quantity that was ordered. | SELECT T2.productName, SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN ( SELECT productCode, productName FROM products ORDER BY MSRP - buyPrice DESC LIMIT 1 ) AS T2 ON T1.productCode = T2.productCode UNION SELECT T2.productName, SUM(quantityOrdered * priceEach) FROM orderdetails AS T1 INNER JOIN ( SELECT productCode, productName FROM products ORDER BY MSRP - buyPrice ASC LIMIT 1 ) AS T2 ON T1.productCode = T2.productCode | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many different orders with a total price greater than 4000 are cancelled? | SELECT COUNT(DISTINCT T1.orderNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.quantityOrdered * T1.priceEach > 4000 AND T2.status = 'Cancelled' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many distinct orders were there in 2003 when the quantity ordered was less than 30? | SELECT COUNT(DISTINCT T1.orderNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.quantityOrdered < 30 AND STRFTIME('%Y', T2.orderDate) = '2003' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the total value of cancelled orders? | SELECT SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T2.status = 'Cancelled' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Please calculate the total value of Motorcycles orders. | SELECT SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productLine = 'Motorcycles' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many Planes orders were there? | SELECT COUNT(T1.productCode) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productLine = 'Planes' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many orders which expected profits greater than 100? | SELECT COUNT(T1.productCode) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.MSRP - T2.buyPrice > 100 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Please calculate the average total price of orders from Exoto Designs Vendor in 2005. | SELECT SUM(T2.quantityOrdered * T2.priceEach) / COUNT(T3.orderNumber) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber WHERE T1.productVendor = 'Exoto Designs' AND STRFTIME('%Y', T3.orderDate) = '2005' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many sales representatives who have office code is 1? | SELECT COUNT(officeCode) FROM employees WHERE jobTitle = 'Sales Rep' AND officeCode = 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Please list different customer names with the payment amount of over 50,000. | SELECT DISTINCT T2.customerName FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.amount > 50000 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Please calculate the total payment amount of customers who come from the USA. | SELECT SUM(T1.amount) FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.country = 'USA' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What are the total payments of customers with no credit limit in 2003? | SELECT SUM(amount) FROM payments WHERE STRFTIME('%Y', paymentDate) = '2003' AND customerNumber IN ( SELECT customerNumber FROM customers WHERE creditLimit = 0 ) | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Please list the name and phone number of the customer whose order was cancelled. | SELECT T2.customerName, T2.phone FROM orders AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.status = 'Cancelled' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many French customers shipped 2 orders which have been cancelled? | SELECT COUNT(T2.country) FROM orders AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.status = 'Shipped' AND T2.country = 'France' GROUP BY T2.customerNumber HAVING COUNT(T1.status) = 2 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Please calculate the average total price of shipped orders from German customers. | SELECT SUM(T3.quantityOrdered * T3.priceEach) / COUNT(T2.orderNumber) FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber INNER JOIN orderdetails AS T3 ON T2.orderNumber = T3.orderNumber WHERE T2.status = 'Shipped' AND T1.country = 'Germany' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | List out full name of employees who are working in Tokyo? | SELECT T1.firstName, T1.lastName FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Tokyo' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many Sales Rep who are working in Tokyo? List out email and full name of those employees. | SELECT T1.firstName, T1.lastName, T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Tokyo' AND T1.jobTitle = 'Sales Rep' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | State the email of those who are staff of Murphy Diane whose number is 1002 and living in San Francisco | SELECT T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.reportsTo = 1002 AND T2.city = 'San Francisco' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Determine the email and Code of employee who are working at United State, state MA | SELECT T1.email, T1.employeeNumber FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.state = 'MA' AND T2.country = 'USA' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many Sales Manager who are working in Sydney? List out their email. | SELECT T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.jobTitle LIKE '%Sales Manager%' AND T2.city = 'Sydney' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many employees who are living in Australia and have the credit limit under 200000? State their email address and countries where they are working. | SELECT T2.email, T3.country FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber INNER JOIN offices AS T3 ON T2.officeCode = T3.officeCode WHERE T3.country = 'Australia' AND T1.creditLimit < 200000 AND T2.jobTitle = 'Sales Rep' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | State 10 emails of UK Sales Rep who have the lowest credit limit. | SELECT DISTINCT T2.email FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep' AND T1.country = 'UK' ORDER BY T1.creditLimit LIMIT 10 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many Australian customers who have credit line under 220000? | SELECT COUNT(creditLimit) FROM customers WHERE creditLimit < 220000 AND country = 'Australia' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | List out 3 customer numbers who have highest amount payment | SELECT customerNumber FROM payments ORDER BY amount DESC LIMIT 3 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Determine the email and Code of employee who are working at United State, state CA | SELECT T1.email, T1.employeeNumber FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.country = 'USA' AND T2.state = 'CA' GROUP BY T1.email, T1.officeCode | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | List out full name of employees who are working in Boston? | SELECT T1.firstName, T1.lastName FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Boston' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | State top 3 emails of UK Sales Rep who have the highest credit limit. | SELECT T2.email FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep' AND T1.country = 'UK' GROUP BY T1.customerName, T2.email ORDER BY SUM(T1.creditLimit) DESC LIMIT 3 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many customers who are in Norway and have credit line under 220000? | SELECT COUNT(creditLimit) FROM customers WHERE creditLimit < 220000 AND country = 'Norway' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | List out full name and email of employees who are working in Paris? | SELECT T1.firstName, T1.lastName, T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Paris' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | List the product code of the top five motorcycles, by descending order, the number of quantity in stock. | SELECT productCode, quantityInStock FROM products WHERE productLine = 'Motorcycles' ORDER BY quantityInStock DESC LIMIT 5 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Among the German customers, how many of the them has credit limit of zero? | SELECT COUNT(customerNumber) FROM customers WHERE creditLimit = 0 AND country = 'Germany' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | From 2003 to 2004, how many customers have paid more than three times? | SELECT COUNT(customernumber) FROM ( SELECT customernumber FROM payments WHERE STRFTIME('%Y', paymentDate) >= '2003' AND STRFTIME('%Y', paymentDate) <= '2004' GROUP BY customernumber HAVING COUNT(customernumber) > 3 ) T | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the average actual profit by 1937 Lincoln Berline? | SELECT SUM(T1.priceEach - T2.buyPrice) / COUNT(*) FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode WHERE T2.productName = '1937 Lincoln Berline' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Among the motorcycles with product scale of 1:10, which of them is the most ordered by American customers? | SELECT T1.productName FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T1.productLine = 'Motorcycles' AND T1.productScale = '1:10' AND T4.country = 'USA' GROUP BY T1.productName ORDER BY SUM(T2.quantityOrdered) DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Between 8/1/2003 and 8/30/2004, how many checks were issued by Mini Gifts Distributors Ltd.? Please list their check numbers. | SELECT T1.checkNumber FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.paymentDate >= '2003-08-01' AND T1.paymentDate <= '2004-08-30' AND T2.customerName = 'Mini Gifts Distributors Ltd.' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | For the planes which has the hightest total price, how much it exceeds the average? | SELECT MAX(quantityOrdered * priceEach) - AVG(priceEach) FROM orderdetails WHERE productCode IN ( SELECT productCode FROM products WHERE productLine = 'Planes' ) | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the total value of shipped vintage car orders from 2003-2004? | SELECT SUM(T2.priceEach * T2.quantityOrdered) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber WHERE T3.status = 'Shipped' AND T3.orderDate BETWEEN '2003-01-01' AND '2004-12-31' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Who is the sales agent of the customer who has made the highest payment? Include the full names of employee and his/her supervisor. | SELECT T1.firstName, T1.lastName, T1.reportsTo FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber ORDER BY T3.amount DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the highest amount of order made by the sales representative in Boston? Please give the name of the product and amount. | SELECT T2.productName, T1.quantityOrdered * T1.priceEach FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T1.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T4.city = 'Boston' AND T4.salesRepEmployeeNumber IN ( SELECT employeeNumber FROM employees WHERE jobTitle = 'Sales Rep' ) ORDER BY T1.quantityOrdered DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the total actual profit gained from orders made by American customers from 2003-01-06 to 2005-05-09? | SELECT SUM(T2.priceEach - T1.buyPrice) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T3.orderDate > '2003-01-05' AND T3.orderDate < '2005-05-10' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | From which branch does the sales representative employee who made the most sales in 2005? Please indicates its full address and phone number. | SELECT T3.addressLine1, T3.addressLine2, T3.phone FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber INNER JOIN customers AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN employees AS T4 ON T3.salesRepEmployeeNumber = T4.employeeNumber INNER JOIN offices AS T5 ON T4.officeCode = T5.officeCode WHERE STRFTIME('%Y', T2.orderDate) = '2005' AND T4.jobTitle = 'Sales Rep' ORDER BY T1.quantityOrdered DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the phone number of all companies where the last name of the contact person starts with the letter M and are not from Germany? | SELECT phone FROM customers WHERE contactLastName LIKE 'M%' AND country != 'Germany' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Calculate the average amount of payments made by customers during the first half of 2004. | SELECT AVG(amount) FROM payments WHERE paymentDate BETWEEN '2004-01-01' AND '2004-06-30' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Of all the orders placed and shipped throughout the year 2005, what percentage of those orders corresponds to customer number 186? | SELECT CAST(SUM(CASE WHEN customerNumber = 186 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(orderNumber) FROM orders WHERE status = 'Shipped' AND shippedDate BETWEEN '2005-01-01' AND '2005-12-31' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many customers with a canceled shipment have a credit limit greater than 115,000? | SELECT COUNT(T1.customerNumber) FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.status = 'Cancelled' AND T1.creditLimit > 115000 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | On what date did the customer with the lowest credit limit serviced by sales representative Barry Jones make payments for his/her orders? | SELECT T3.paymentDate FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber WHERE T1.firstName = 'Barry' AND T1.lastName = 'Jones' AND T1.jobTitle = 'Sales Rep' ORDER BY T2.creditLimit ASC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | To whom does the employee have to inform that is the sales representative of the French customer? | SELECT T1.reportsTo FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber WHERE T2.country = 'France' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the full address of the customer who commented that DHL be used for the order that was shipped on April 4, 2005? | SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.shippedDate = '2005-04-04' AND T2.status = 'Shipped' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the full address of the office where the employee who is a sales representative for the customer whose business is located in the city of New York works? | SELECT T2.addressLine1, T2.addressLine2 FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN offices AS T3 ON T1.officeCode = T3.officeCode WHERE T2.city = 'NYC' AND T1.jobTitle = 'Sales Rep' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What is the full address of the office where 4 people work and one of them is Sales Representation? | SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What profit can the seller Carousel DieCast Legends make from the sale of the product described as "The perfect holiday or anniversary gift for executives"? | SELECT SUM(T2.MSRP - T2.buyPrice) FROM productlines AS T1 INNER JOIN products AS T2 ON T1.productLine = T2.productLine WHERE T2.productVendor = 'Carousel DieCast Legends' AND T1.textDescription LIKE '%perfect holiday or anniversary gift for executives%' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Of the clients whose businesses are located in the city of Boston, calculate which of them has a higher average amount of payment. | SELECT T1.customerNumber FROM customers AS T1 INNER JOIN payments AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.city = 'Boston' GROUP BY T1.customerNumber ORDER BY SUM(T2.amount) / COUNT(T2.paymentDate) DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Calculate the total quantity ordered for 18th Century Vintage Horse Carriage and the average price. | SELECT SUM(T2.quantityOrdered) , SUM(T2.quantityOrdered * T2.priceEach) / SUM(T2.quantityOrdered) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode WHERE T1.productName = '18th Century Vintage Horse Carriage' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many kinds of products did order No. 10252 contain? | SELECT COUNT(t.productCode) FROM orderdetails t WHERE t.orderNumber = '10252' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Who is the sales representative that made the order which was sent to 25 Maiden Lane, Floor No. 4? | SELECT T2.firstName, T2.lastName FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T1.addressLine1 = '25 Maiden Lane' AND T1.addressLine2 = 'Floor No. 4' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Where's Foon Yue Tseng's office located at? Give the detailed address. | SELECT T1.addressLine1, T1.addressLine2 FROM offices AS T1 INNER JOIN employees AS T2 ON T1.officeCode = T2.officeCode WHERE T2.firstName = 'Foon Yue' AND T2.lastName = 'Tseng' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Compared with the orders happened on 2005-04-08 and two days later, which day's order had a higher value? | SELECT T2.orderDate FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE STRFTIME('%Y-%m-%d', T2.orderDate) = '2005-04-08' OR STRFTIME('%Y-%m-%d', T2.orderDate) = '2005-04-10' ORDER BY T1.quantityOrdered * T1.priceEach DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many products with the highest expected profits were sold in total? | SELECT SUM(t2.quantityOrdered) FROM orderdetails AS t2 INNER JOIN ( SELECT t1.productCode FROM products AS t1 ORDER BY t1.MSRP - t1.buyPrice DESC LIMIT 1 ) AS t3 ON t2.productCode = t3.productCode | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How much did Petit Auto pay on 2004-08-09? | SELECT t1.amount FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.customerName = 'Petit Auto' AND t1.paymentDate = '2004-08-09' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What was the contact name for the check "NR157385"? | SELECT t2.contactFirstName, t2.contactLastName FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.checkNumber = 'NR157385' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Which customer made the order No. 10160? Give the contact name. | SELECT t2.contactFirstName, t2.contactLastName FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.orderNumber = '10160' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Where was the order No. 10383 shipped to? Show me the address. | SELECT t2.addressLine1, t2.addressLine2 FROM orders AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.orderNumber = '10383' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | For the productline where the product No.S18_2949 was produced, what's the text description for that product line? | SELECT t1.textDescription FROM productlines AS t1 INNER JOIN products AS t2 ON t1.productLine = t2.productLine WHERE t2.productCode = 'S18_2949' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | If Dragon Souveniers, Ltd. aren't satisfied with their order and want to send a complain e-mail, which e-mail address should they send to? | SELECT t2.email FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Dragon Souveniers, Ltd.' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How many French customers does Gerard Hernandez take care of? | SELECT COUNT(t1.customerNumber) FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.country = 'France' AND t2.firstName = 'Gerard' AND t2.lastName = 'Hernandez' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | What was the latest order that customer No.114 made? Give the name of the product. | SELECT t3.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN products AS t3 ON t1.productCode = t3.productCode WHERE t2.customerNumber = '114' ORDER BY t2.orderDate DESC LIMIT 1 | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | For the product No. S18_3482 in the Order No.10108, how much discount did the customer have? | SELECT (t1.MSRP - t2.priceEach) / t1.MSRP FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode WHERE t1.productCode = 'S18_3482' AND t2.orderNumber = '10108' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | To whom does Steve Patterson report? Please give his or her full name. | SELECT t2.firstName, t2.lastName FROM employees AS t1 INNER JOIN employees AS t2 ON t2.employeeNumber = t1.reportsTo WHERE t1.firstName = 'Steve' AND t1.lastName = 'Patterson' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | How do I contact the President of the company? | SELECT t.email FROM employees t WHERE t.jobTitle = 'President' | bird |
CREATE TABLE car_retails (officeCode text, city text, phone text, addressLine1 text, addressLine2 text, state text, country text, postalCode text, territory text, employeeNumber integer, lastName text, firstName text, extension text, email text, officeCode text, reportsTo integer, jobTitle text, customerNumber integer, customerName text, contactLastName text, contactFirstName text, phone text, addressLine1 text, addressLine2 text, city text, state text, postalCode text, country text, salesRepEmployeeNumber integer, creditLimit real, orderNumber integer, orderDate date, requiredDate date, shippedDate date, status text, comments text, customerNumber integer, customerNumber integer, checkNumber text, paymentDate date, amount real, productLine text, textDescription text, htmlDescription text, image blob, productCode text, productName text, productLine text, productScale text, productVendor text, productDescription text, quantityInStock integer, buyPrice real, MSRP real, orderNumber integer, productCode text, quantityOrdered integer, priceEach real, orderLineNumber integer) | Who is the sales representitive of Muscle Machine Inc? Please give the employee's full name. | SELECT t2.firstName, t2.lastName FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Muscle Machine Inc' | bird |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.