db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
synthea | select cast(sum(case when t2.gender = 'f' then 1 else 0 end) as real) * 100 / count(t1.patient) from encounters as t1 inner join patients as t2 on t1.patient = t2.patient where strftime('%y', t1.date) = '2010' and t1.reasondescription = 'contact dermatitis' | Question: among all patients who sought medical attention in 2010 due to contact dermatitis, identify the percentage of females. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, p... | among all patients who sought medical attention in 2010 due to contact dermatitis, identify the percentage of females. |
synthea | select count(t1.patient) , cast(sum(case when t2.description = 'prenatal visit' then 1 else 0 end) as real) * 100 / count(t1.patient) from patients as t1 inner join encounters as t2 on t1.patient = t2.patient where t1.first = 'lorri' and t1.last = 'simonis' and strftime('%y', t2.date) between '2010' and '2017' | Question: how many interactions did lorri simons have with medical professionals between 2010 and 2017? what percentage of encounters are attributed to prenatal visits? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthda... | how many interactions did lorri simons have with medical professionals between 2010 and 2017? what percentage of encounters are attributed to prenatal visits? |
synthea | select t1.description from medications as t1 inner join patients as t2 on t1.patient = t2.patient where t2.first = 'joye' and t2.last = 'homenick' | Question: state description of medication taken by joe homenick. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity, ge... | state description of medication taken by joe homenick. |
synthea | select distinct t1.start from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.maiden = 'adams' | Question: what is the start date of the care plan of the patient whose maiden name is adams? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, ... | what is the start date of the care plan of the patient whose maiden name is adams? |
synthea | select t2.first, t2.last from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.gender = 'm' order by t1.start limit 1 | Question: among the male patients, who has the earliest starting date of the care plan? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marit... | among the male patients, who has the earliest starting date of the care plan? |
synthea | select cast(sum(case when t2.race = 'hispanic' then 1 else 0 end) as real) * 100 / count(t1.patient) from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where strftime('%y', t1.stop) = '2011' | Question: what is the percentage of hispanic patients who stopped their care plan in 2011? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, ma... | what is the percentage of hispanic patients who stopped their care plan in 2011? |
synthea | select distinct t1.reasondescription from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.first = 'angelo' and t2.last = 'buckridge' | Question: state the description of the reason why angelo buckridge needs the care plan. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marit... | state the description of the reason why angelo buckridge needs the care plan. |
synthea | select distinct t1.description from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.ethnicity = 'american' | Question: mention the description of the care plan of american patients. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethni... | mention the description of the care plan of american patients. |
synthea | select distinct t1.encounter from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.birthplace = 'pembroke ma us' | Question: what are the medical encounter ids of patients who were born in pembroke ma us? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, mar... | what are the medical encounter ids of patients who were born in pembroke ma us? |
synthea | select distinct t1.start from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.deathdate is null | Question: list out the start date of the care plan of alive patients. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicit... | list out the start date of the care plan of alive patients. |
synthea | select count(distinct t1.patient) from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.race = 'white' and t1.reasoncode = '10509002' | Question: how many white patients have the reason code of 10509002? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity,... | how many white patients have the reason code of 10509002? |
synthea | select distinct t2.first, t2.last from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t1.description = 'diabetic diet' | Question: list out full name of patients who have 'diabetic diet' in the description of the care plan. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix... | list out full name of patients who have 'diabetic diet' in the description of the care plan. |
synthea | select distinct t1.stop from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.deathdate is not null and t1.stop is not null | Question: list out the stop date of the care plan of dead patients. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity,... | list out the stop date of the care plan of dead patients. |
synthea | select count(distinct t2.patient) from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.ethnicity = 'italian' and t1.code = '304510005' | Question: how many italian patients have the care plan code of 304510005? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethn... | how many italian patients have the care plan code of 304510005? |
synthea | select cast(sum(case when t2.gender = 'f' then 1 else 0 end) as real) * 100 / count(t1.patient) as percentage from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where strftime('%y', t1.start) = '2010' | Question: what is the percentage of female patients who started the care plan in 2010? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marita... | what is the percentage of female patients who started the care plan in 2010? |
synthea | select count(distinct t2.patient) from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.race = 'black' and strftime('%y', t1.stop) = '2017' | Question: how many black patients stopped their care plan in 2017? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity, ... | how many black patients stopped their care plan in 2017? |
synthea | select count(distinct t1.patient) from patients as t1 inner join conditions as t2 where t2.description = 'prediabetes' and t1.gender = 'm' | Question: how many male patients have prediabetes condition? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity, gender... | how many male patients have prediabetes condition? |
synthea | select distinct t1.first, t1.last from patients as t1 inner join allergies as t2 on t1.patient = t2.patient where t2.description = 'allergy to nut' | Question: list the full names of patients with nut allergy. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity, gender,... | list the full names of patients with nut allergy. |
synthea | select t2.description from patients as t1 inner join conditions as t2 on t1.patient = t2.patient where t1.first = 'wilmer' and t1.last = 'koepp' | Question: describe the condition of patient wilmer koepp. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity, gender, b... | describe the condition of patient wilmer koepp. |
synthea | select sum(case when t1.gender = 'f' then 1 else 0 end), sum(case when t1.gender = 'm' then 1 else 0 end) from patients as t1 inner join conditions as t2 on t1.patient = t2.patient where t2.description = 'viral sinusitis (disorder)' | Question: among the patients with viral sinusitis condition, which patient's gender is most affected? provide the number for each respectively. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drive... | among the patients with viral sinusitis condition, which patient's gender is most affected? provide the number for each respectively. |
synthea | select distinct t1.first, t1.last from patients as t1 inner join medications as t2 on t1.patient = t2.patient where t2.description = 'penicillin v potassium 250 mg' and strftime('%y', t2.start) >= '1948' | Question: provide the full names of patients who have been taking penicillin v potassium 250 mg since 1948. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, s... | provide the full names of patients who have been taking penicillin v potassium 250 mg since 1948. |
synthea | select count(distinct t1.patient) from patients as t1 inner join conditions as t2 on t1.patient = t2.patient where strftime('%y', t1.birthdate) = '1935' and t1.race = 'white' and t2.description = 'stroke' | Question: how many white patients whose birth year is 1935 have a stroke? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethn... | how many white patients whose birth year is 1935 have a stroke? |
synthea | select distinct t2.description from patients as t1 inner join conditions as t2 on t1.patient = t2.patient inner join immunizations as t3 on t1.patient = t3.patient where t3.description = 'ipv' | Question: which conditions the patient has when receiving the ipv immunization? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race... | which conditions the patient has when receiving the ipv immunization? |
synthea | select t1.patient from patients as t1 inner join conditions as t2 on t1.patient = t2.patient inner join all_prevalences as t3 on t3.item = t2.description order by t3.occurrences desc limit 1 | Question: list the patient ids whose disease has the most occurrences. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnici... | list the patient ids whose disease has the most occurrences. |
synthea | select distinct t1.first, t1.last from patients as t1 inner join conditions as t2 on t1.patient = t2.patient where t2.description = 'cystitis' | Question: list all the full names of patients with a condition described as cystitis. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital... | list all the full names of patients with a condition described as cystitis. |
synthea | select count(distinct t1.patient) from patients as t1 inner join immunizations as t2 on t1.patient = t2.patient where t2.description = 'hpv quadrivalent' and t1.gender = 'm' | Question: how many male patients have been described as immune to quadrivalent hpv? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, ... | how many male patients have been described as immune to quadrivalent hpv? |
synthea | 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' | Question: indicate the start date of patient walter bahringer's care plan. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, eth... | indicate the start date of patient walter bahringer's care plan. |
synthea | 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' | Question: describe the care plans of patient major d'amore's plan of care. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, eth... | describe the care plans of patient major d'amore's plan of care. |
synthea | 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)' | Question: calculate the percentage of male patients with viral sinusitis condition. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, ... | calculate the percentage of male patients with viral sinusitis condition. |
synthea | 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' | Question: among the patients who have been using penicillin v potassium 250 mg, what percentage of patients are female? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, fi... | among the patients who have been using penicillin v potassium 250 mg, what percentage of patients are female? |
synthea | 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' | Question: among the white patients, what is the average body height of the patients? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital,... | among the white patients, what is the average body height of the patients? |
synthea | 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' | Question: indicate the care plan needed for the patient living at 179 sydni roads, taunton, ma 02780 us. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suff... | indicate the care plan needed for the patient living at 179 sydni roads, taunton, ma 02780 us. |
synthea | 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' | Question: provide the allergen of the dominican patient named dirk languish. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, e... | provide the allergen of the dominican patient named dirk languish. |
synthea | 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' | Question: how many patients who are allergic to peanuts have asthma? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity... | how many patients who are allergic to peanuts have asthma? |
synthea | 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 | Question: who is the 44-year-old patient diagnosed with drug overdose? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnici... | who is the 44-year-old patient diagnosed with drug overdose? |
synthea | 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 | Question: provide the social security number of the patient with the highest systolic blood pressure. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix,... | provide the social security number of the patient with the highest systolic blood pressure. |
synthea | 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 | Question: what is the care plan description of the prevalent disease with the highest prevalence percentage? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, ... | what is the care plan description of the prevalent disease with the highest prevalence percentage? |
synthea | select distinct t1.description from careplans as t1 inner join patients as t2 on t1.patient = t2.patient where t2.ssn = '999-15-3685' | Question: what is the care plan for the patient with social security number 999-15-3685? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, mari... | what is the care plan for the patient with social security number 999-15-3685? |
synthea | 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.descriptio... | Question: calculate the average age of the male patients that have hypertension. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, rac... | calculate the average age of the male patients that have hypertension. |
synthea | 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 | Question: list 5 patients' name that need medication due to streptococcal sore throat disorder. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maide... | list 5 patients' name that need medication due to streptococcal sore throat disorder. |
synthea | 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 | Question: who is the patient with a body weight of 61.97 kg? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, first, last, suffix, maiden, marital, race, ethnicity, gender... | who is the patient with a body weight of 61.97 kg? |
synthea | 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 | Question: among the male patients, list down 5 birth dates of patients taking the medication 'penicillin v potassium 250 mg'. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, pref... | among the male patients, list down 5 birth dates of patients taking the medication 'penicillin v potassium 250 mg'. |
synthea | 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 | Question: 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. | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> pati... | 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. |
synthea | 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' | Question: what is the difference between the number of married patients and the number of single patients with diabetes? | Tables: all_prevalences -> ITEM, POPULATION TYPE, OCCURRENCES, POPULATION COUNT, PREVALENCE RATE, PREVALENCE PERCENTAGE. patients -> patient, birthdate, deathdate, ssn, drivers, passport, prefix, f... | what is the difference between the number of married patients and the number of single patients with diabetes? |
car_retails | select country, count(customernumber) from customers group by country | Question: list the country and how many customers are there. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerName, co... | list the country and how many customers are there. |
car_retails | 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 | Question: which different vendor has the most amount of orders? calculate the total estimated earnings. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. cu... | which different vendor has the most amount of orders? calculate the total estimated earnings. |
car_retails | 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 | Question: who is the sales agent of the distinct customer who paid the highest amount in the year 2004? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. cu... | who is the sales agent of the distinct customer who paid the highest amount in the year 2004? |
car_retails | 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' | Question: what was the total price of the products shipped to rovelli gifts distributors ltd. between 1/1/2003 and 12/31/2003? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, ... | what was the total price of the products shipped to rovelli gifts distributors ltd. between 1/1/2003 and 12/31/2003? |
car_retails | select count(employeenumber) from employees where officecode = ( select officecode from offices where city = 'sydney' ) | Question: how many employees are there in sydney? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerName, contactLastNa... | how many employees are there in sydney? |
car_retails | 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' | Question: which sales representatives in new york city whose leader is anthony bow with the employee number is 1143? indicate their employee numbers. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extensi... | which sales representatives in new york city whose leader is anthony bow with the employee number is 1143? indicate their employee numbers. |
car_retails | 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' | Question: what is the average, highest and lowest annual payments collected between 1/1/2003 to 12/31/2005? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle... | what is the average, highest and lowest annual payments collected between 1/1/2003 to 12/31/2005? |
car_retails | 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 | Question: which countries do the top 5 highest paying customers in a single payment come from? indicate their entire address. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, r... | which countries do the top 5 highest paying customers in a single payment come from? indicate their entire address. |
car_retails | 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' | Question: how many checks were issued by euro+ shopping channel in the year 2004? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNum... | how many checks were issued by euro+ shopping channel in the year 2004? |
car_retails | 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 | Question: of all the classic cars, with a product scale of 1:18, which product is the most ordered product by customers? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, report... | of all the classic cars, with a product scale of 1:18, which product is the most ordered product by customers? |
car_retails | 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 <= 100... | Question: 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? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extensi... | 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? |
car_retails | 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 = 't... | Question: 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. | Tables: offices -> officeCode, cit... | 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. |
car_retails | 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 jo... | Question: 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. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, ... | 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. |
car_retails | 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' | Question: how many different orders with a total price greater than 4000 are cancelled? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> custo... | how many different orders with a total price greater than 4000 are cancelled? |
car_retails | 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' | Question: how many distinct orders were there in 2003 when the quantity ordered was less than 30? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customer... | how many distinct orders were there in 2003 when the quantity ordered was less than 30? |
car_retails | select sum(t1.quantityordered * t1.priceeach) from orderdetails as t1 inner join orders as t2 on t1.ordernumber = t2.ordernumber where t2.status = 'cancelled' | Question: what is the total value of cancelled orders? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerName, contactL... | what is the total value of cancelled orders? |
car_retails | select sum(t1.quantityordered * t1.priceeach) from orderdetails as t1 inner join products as t2 on t1.productcode = t2.productcode where t2.productline = 'motorcycles' | Question: please calculate the total value of motorcycles orders. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerNam... | please calculate the total value of motorcycles orders. |
car_retails | select count(t1.productcode) from orderdetails as t1 inner join products as t2 on t1.productcode = t2.productcode where t2.productline = 'planes' | Question: how many planes orders were there? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerName, contactLastName, c... | how many planes orders were there? |
car_retails | select count(t1.productcode) from orderdetails as t1 inner join products as t2 on t1.productcode = t2.productcode where t2.msrp - t2.buyprice > 100 | Question: how many orders which expected profits greater than 100? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerNa... | how many orders which expected profits greater than 100? |
car_retails | 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' | Question: please calculate the average total price of orders from exoto designs vendor in 2005. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers ... | please calculate the average total price of orders from exoto designs vendor in 2005. |
car_retails | select count(officecode) from employees where jobtitle = 'sales rep' and officecode = 1 | Question: how many sales representatives who have office code is 1? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerN... | how many sales representatives who have office code is 1? |
car_retails | select distinct t2.customername from payments as t1 inner join customers as t2 on t1.customernumber = t2.customernumber where t1.amount > 50000 | Question: please list different customer names with the payment amount of over 50,000. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> custom... | please list different customer names with the payment amount of over 50,000. |
car_retails | select sum(t1.amount) from payments as t1 inner join customers as t2 on t1.customernumber = t2.customernumber where t2.country = 'usa' | Question: please calculate the total payment amount of customers who come from the usa. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> custo... | please calculate the total payment amount of customers who come from the usa. |
car_retails | select sum(amount) from payments where strftime('%y', paymentdate) = '2003' and customernumber in ( select customernumber from customers where creditlimit = 0 ) | Question: what are the total payments of customers with no credit limit in 2003? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumb... | what are the total payments of customers with no credit limit in 2003? |
car_retails | select t2.customername, t2.phone from orders as t1 inner join customers as t2 on t1.customernumber = t2.customernumber where t1.status = 'cancelled' | Question: please list the name and phone number of the customer whose order was cancelled. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> cu... | please list the name and phone number of the customer whose order was cancelled. |
car_retails | 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 | Question: how many french customers shipped 2 orders which have been cancelled? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumbe... | how many french customers shipped 2 orders which have been cancelled? |
car_retails | 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' | Question: please calculate the average total price of shipped orders from german customers. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> c... | please calculate the average total price of shipped orders from german customers. |
car_retails | select t1.firstname, t1.lastname from employees as t1 inner join offices as t2 on t1.officecode = t2.officecode where t2.city = 'tokyo' | Question: list out full name of employees who are working in tokyo? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customerN... | list out full name of employees who are working in tokyo? |
car_retails | 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' | Question: how many sales rep who are working in tokyo? list out email and full name of those employees. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. cu... | how many sales rep who are working in tokyo? list out email and full name of those employees. |
car_retails | 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' | Question: state the email of those who are staff of murphy diane whose number is 1002 and living in san francisco | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jo... | state the email of those who are staff of murphy diane whose number is 1002 and living in san francisco |
car_retails | 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' | Question: determine the email and code of employee who are working at united state, state ma | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> ... | determine the email and code of employee who are working at united state, state ma |
car_retails | 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' | Question: how many sales manager who are working in sydney? list out their email. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNum... | how many sales manager who are working in sydney? list out their email. |
car_retails | 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' | Question: 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. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstNa... | 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. |
car_retails | 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 | Question: state 10 emails of uk sales rep who have the lowest credit limit. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, c... | state 10 emails of uk sales rep who have the lowest credit limit. |
car_retails | select count(creditlimit) from customers where creditlimit < 220000 and country = 'australia' | Question: how many australian customers who have credit line under 220000? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, cu... | how many australian customers who have credit line under 220000? |
car_retails | select customernumber from payments order by amount desc limit 3 | Question: list out 3 customer numbers who have highest amount payment | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, custome... | list out 3 customer numbers who have highest amount payment |
car_retails | 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 | Question: determine the email and code of employee who are working at united state, state ca | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> ... | determine the email and code of employee who are working at united state, state ca |
car_retails | select t1.firstname, t1.lastname from employees as t1 inner join offices as t2 on t1.officecode = t2.officecode where t2.city = 'boston' | Question: list out full name of employees who are working in boston? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customer... | list out full name of employees who are working in boston? |
car_retails | 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 | Question: state top 3 emails of uk sales rep who have the highest credit limit. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumbe... | state top 3 emails of uk sales rep who have the highest credit limit. |
car_retails | select count(creditlimit) from customers where creditlimit < 220000 and country = 'norway' | Question: how many customers who are in norway and have credit line under 220000? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNum... | how many customers who are in norway and have credit line under 220000? |
car_retails | 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' | Question: list out full name and email of employees who are working in paris? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber,... | list out full name and email of employees who are working in paris? |
car_retails | select productcode, quantityinstock from products where productline = 'motorcycles' order by quantityinstock desc limit 5 | Question: list the product code of the top five motorcycles, by descending order, the number of quantity in stock. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, j... | list the product code of the top five motorcycles, by descending order, the number of quantity in stock. |
car_retails | select count(customernumber) from customers where creditlimit = 0 and country = 'germany' | Question: among the german customers, how many of the them has credit limit of zero? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customer... | among the german customers, how many of the them has credit limit of zero? |
car_retails | 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 | Question: from 2003 to 2004, how many customers have paid more than three times? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumb... | from 2003 to 2004, how many customers have paid more than three times? |
car_retails | 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' | Question: what is the average actual profit by 1937 lincoln berline? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumber, customer... | what is the average actual profit by 1937 lincoln berline? |
car_retails | 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 = 'us... | Question: among the motorcycles with product scale of 1:10, which of them is the most ordered by american customers? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo,... | among the motorcycles with product scale of 1:10, which of them is the most ordered by american customers? |
car_retails | 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.' | Question: between 8/1/2003 and 8/30/2004, how many checks were issued by mini gifts distributors ltd.? please list their check numbers. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, off... | between 8/1/2003 and 8/30/2004, how many checks were issued by mini gifts distributors ltd.? please list their check numbers. |
car_retails | select max(quantityordered * priceeach) - avg(priceeach) from orderdetails where productcode in ( select productcode from products where productline = 'planes' ) | Question: for the planes which has the hightest total price, how much it exceeds the average? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers ->... | for the planes which has the hightest total price, how much it exceeds the average? |
car_retails | 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' | Question: what is the total value of shipped vintage car orders from 2003-2004? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. customers -> customerNumbe... | what is the total value of shipped vintage car orders from 2003-2004? |
car_retails | 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 | Question: who is the sales agent of the customer who has made the highest payment? include the full names of employee and his/her supervisor. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, emai... | who is the sales agent of the customer who has made the highest payment? include the full names of employee and his/her supervisor. |
car_retails | 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.salesrepemployeenum... | Question: what is the highest amount of order made by the sales representative in boston? please give the name of the product and amount. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, o... | what is the highest amount of order made by the sales representative in boston? please give the name of the product and amount. |
car_retails | 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' | Question: what is the total actual profit gained from orders made by american customers from 2003-01-06 to 2005-05-09? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsT... | what is the total actual profit gained from orders made by american customers from 2003-01-06 to 2005-05-09? |
car_retails | 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 =... | Question: from which branch does the sales representative employee who made the most sales in 2005? please indicates its full address and phone number. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, exten... | from which branch does the sales representative employee who made the most sales in 2005? please indicates its full address and phone number. |
car_retails | select phone from customers where contactlastname like 'm%' and country != 'germany' | Question: 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? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, e... | 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? |
car_retails | select avg(amount) from payments where paymentdate between '2004-01-01' and '2004-06-30' | Question: calculate the average amount of payments made by customers during the first half of 2004. | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email, officeCode, reportsTo, jobTitle. custom... | calculate the average amount of payments made by customers during the first half of 2004. |
car_retails | 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' | Question: of all the orders placed and shipped throughout the year 2005, what percentage of those orders corresponds to customer number 186? | Tables: offices -> officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory. employees -> employeeNumber, lastName, firstName, extension, email... | of all the orders placed and shipped throughout the year 2005, what percentage of those orders corresponds to customer number 186? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.