schema
stringlengths
20
14.6k
query
stringlengths
17
2.58k
question
stringlengths
8
1.06k
<table0>[cost] { <col0>[costid]:[number] <col1>[uniquepid]:[text] <col2>[patienthealthsystemstayid]:[number] <col3>[eventtype]:[text] <col4>[eventid]:[number] <col5>[chargetime]:[time] } <table1>[allergy] { <col0>[allergyid]:[number] <col1>[patientunitstayid]:[number] <col2>[drugname]:[text] <col3>[allergyname]:[text]...
SELECT `<table7>`.observationtime FROM `<table7>` WHERE `<table7>`.`<table5>`unitstayid IN ( SELECT `<table5>`.`<table5>`unitstayid FROM `<table5>` WHERE `<table5>`.`<table5>`healthsystemstayid IN ( SELECT `<table5>`.`<table5>`healthsystemstayid FROM `<table5>` WHERE `<table5>`.uniquepid = '009-5001' ) ) AND NOT `<tabl...
when first did patient 009-5001 have the maximum heartrate on this month/28?
<table0>[ship] { <col0>[VARCHAR]:[Nationality] }
SELECT Name FROM `<table0>` WHERE Nationality <> "United States"
List the name of ships whose nationality is not "United States".
<table0>[table_name_97] { <col0>[extra_points]:[INTEGER] <col1>[player]:[VARCHAR] <col2>[field_goals]:[VARCHAR] }
SELECT MAX( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "herman everhardus" AND `<col2>` > 0
Which Extra points is the highest one that has a Player of herman everhardus, and a Field goals larger than 0?
<table0>[table_7458] { <col0>[Week]:[real] <col1>[Date]:[text] <col2>[Opponent]:[text] <col3>[Result]:[text] <col4>[Attendance]:[real] }
SELECT "Result" FROM `<table0>` WHERE "Attendance" > '18,648' AND "Date" = 'october 12, 1952'
What was the result of the game attended by more than 18,648 on October 12, 1952?
<table0>[table_name_68] { <col0>[year]:[VARCHAR] <col1>[runs]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "144"
What was the year with runs of 144?
<table0>[patients] { <col0>[INT]:[name] <col1>[VARCHAR]:[age] <col2>[INT]:[gender] <col3>[VARCHAR]:[state] <col4>[VARCHAR]:[INSERT] } <table1>[diagnoses] { <col0>[INT]:[patient_id] <col1>[INT]:[diagnosis] <col2>[VARCHAR]:[diagnosis_date] <col3>[DATE]:[INSERT] }
SELECT AVG( age ) FROM `<table0>` JOIN diagnoses ON `<table0>`.id = diagnoses.patient_id WHERE diagnoses.diagnosis = 'Diabetes' AND `<table0>`.gender = 'Female' AND `<table0>`.state = 'Texas';
What is the average age of female patients diagnosed with diabetes in rural Texas?
<table0>[class_of_service] { <col0>[booking_class]:[varchar] <col1>[rank]:[int] <col2>[class_description]:[text] } <table1>[fare] { <col0>[fare_id]:[int] <col1>[from_airport]:[varchar] <col2>[to_airport]:[varchar] <col3>[fare_basis_code]:[text] <col4>[fare_airline]:[text] <col5>[restriction_code]:[text] <col6>[one_dir...
SELECT DISTINCT flight.flight_id FROM `<table23>` AS AIRPORT_SERVICE_0, `<table23>` AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ( CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 21 AND date_day.month_number = 2 AND da...
show me flights from PITTSBURGH to SAN FRANCISCO on monday
<table0>[departments] { <col0>[DEPARTMENT_ID]:[decimal] <col1>[DEPARTMENT_NAME]:[varchar] <col2>[MANAGER_ID]:[decimal] <col3>[LOCATION_ID]:[decimal] } <table1>[employees] { <col0>[EMPLOYEE_ID]:[decimal] <col1>[FIRST_NAME]:[varchar] <col2>[LAST_NAME]:[varchar] <col3>[EMAIL]:[varchar] <col4>[PHONE_NUMBER]:[varchar] <col...
SELECT HIRE_DATE, SUM( `<col7>` ) FROM `<table1>` WHERE NOT `<col0>` IN ( SELECT `<col0>` FROM `<table3>` ) ORDER BY SUM( `<col7>` ) DESC
For those employees who did not have any job in the past, draw a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time, and sort by the Y-axis in desc.
<table0>[patients] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[gender]:[text] <col3>[dob]:[time] <col4>[dod]:[time] } <table1>[transfers] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[eventtype]:[text] <col5>[careunit]:[text] <col6>[w...
SELECT SUM( `<table14>`.amount ) FROM `<table14>` WHERE `<table14>`.icustay_id IN ( SELECT `<table3>`.icustay_id FROM `<table3>` WHERE `<table3>`.hadm_id IN ( SELECT `<table2>`.hadm_id FROM `<table2>` WHERE `<table2>`.subject_id = 12775 ) ) AND DATETIME( `<table14>`.charttime, 'start of day' ) = DATETIME( CURRENT_TIME(...
calculate the total amount of input patient 12775 had today.
<table0>[VenueW] { <col0>[event_id]:[INT] <col1>[attendee_id]:[INT] <col2>[age_group]:[VARCHAR] } <table1>[AgeGroups] { <col0>[age_group]:[VARCHAR] <col1>[lower_age]:[INT] <col2>[upper_age]:[INT] }
SELECT v.age_group, COUNT( DISTINCT v.attendee_id ) AS unique_attendees, AVG( v.amount ) AS avg_spent FROM `<table0>` v JOIN AgeGroups a ON v.age_group = a.age_group GROUP BY v.age_group;
How many unique audience members have attended events at 'VenueW' in each age group, and what is the average amount spent per age group?
<table0>[subway_stations] { <col0>[station_id]:[INT] <col1>[station_name]:[VARCHAR] <col2>[city]:[VARCHAR] <col3>[time_between_arrivals]:[TIME] <col4>[rush_hour]:[BOOLEAN] }
SELECT MIN( TIME_TO_SEC( `<col3>` ) )/60.0 FROM `<table0>` WHERE `<col2>` = 'Toronto' AND `<col4>` = false;
What is the minimum time between subway train arrivals in Toronto during off-peak hours?
<table0>[table_25851971_1] { <col0>[INTEGER]:[written_by] }
SELECT MAX( no ) FROM `<table0>` WHERE written_by = "Karin Gist"
What episode number was written by Karin Gist?
<table0>[table_1676073_12] { <col0>[club]:[VARCHAR] <col1>[points_for]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "748"
What clubs recorded 748 points to the good?
<table0>[table_name_50] { <col0>[total]:[VARCHAR] <col1>[to_par]:[VARCHAR] }
SELECT COUNT( `<col0>` ) FROM `<table0>` WHERE `<col1>` = 7
What is the total number of Total, when To Par is "7"?
<table0>[cases] { <col0>[INT]:[state] <col1>[VARCHAR]:[billing_amount] <col2>[DECIMAL]:[INSERT] }
SELECT MAX( billing_amount ) FROM `<table0>` WHERE state = 'TX';
What is the maximum billing amount for cases in Texas?
<table0>[table_204_184] { <col0>[number]:[number] <col1>[title]:[text] <col2>[producer]:[text] <col3>[featured]:[guest] <col4>[text]:[length] }
SELECT "title" FROM `<table0>` WHERE "title" IN ( '"dem boyz"', '"felonies"' ) AND "featured guest( s )" = 'p. diddy'
is dem boyz or felonies have the featured guest p. diddy ?
<table0>[Donations] { <col0>[donation_id]:[INT] <col1>[region]:[VARCHAR] <col2>[DECIMAL]:[donation_year] <col3>[INT]:[INSERT] }
SELECT AVG( amount ) FROM `<table0>` WHERE `<col1>` = 'New England' AND donation_year = 2019;
What was the average donation amount for 'New England' in the year 2019?
<table0>[table_20667854_1] { <col0>[company]:[VARCHAR] <col1>[free_float]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "0.2726"
Which companies have a free float of 0.2726?
<table0>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table1>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type...
SELECT `<table2>`.days_stay, prescriptions.route FROM `<table2>` INNER JOIN prescriptions ON `<table2>`.hadm_id = prescriptions.hadm_id WHERE `<table2>`.name = "Gus Marques"
specify duration of hospital stay and drug route of patient gus marques
<table0>[table_204_786] { <col0>[number]:[riding] <col1>[text]:[candidate] <col2>[text]:[gender] <col3>[text]:[residence] <col4>[text]:[occupation] <col5>[text]:[votes] <col6>[number]:[number] <col7>[rank]:[text] <col8>[biographical]:[notes] }
SELECT COUNT( "candidate" ) FROM `<table0>` WHERE "residence" = 'halifax'
how many candidates were from halifax ?
<table0>[microbiologyevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[charttime]:[time] <col4>[spec_type_desc]:[text] <col5>[org_name]:[text] } <table1>[d_icd_procedures] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text]...
SELECT `<table12>`.dose_val_rx FROM `<table12>` WHERE `<table12>`.hadm_id IN ( SELECT `<table7>`.hadm_id FROM `<table7>` WHERE `<table7>`.subject_id = 7375 ) AND `<table12>`.drug = 'artificial tear ointment' ORDER BY `<table12>`.startdate LIMIT 1
what was the first amount of artificial tear ointment that was prescribed to patient 7375?
<table0>[employee] { <col0>[emp_num]:[number] <col1>[emp_lname]:[text] <col2>[emp_fname]:[text] <col3>[emp_initial]:[text] <col4>[emp_jobcode]:[text] <col5>[emp_hiredate]:[time] <col6>[emp_dob]:[time] } <table1>[course] { <col0>[crs_code]:[text] <col1>[dept_code]:[text] <col2>[crs_description]:[text] <col3>[crs_credit...
SELECT T1.stu_fname FROM `<table3>` AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN class AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM `<table3>` AS ...
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
<table0>[table_18333678_2] { <col0>[arrival]:[VARCHAR] <col1>[departure]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "11.35"
when does the train departuring at 11.35 arrive
<table0>[table_7875] { <col0>[Rank]:[text] <col1>[Player]:[text] <col2>[Lifespan]:[text] <col3>[Country]:[text] <col4>[Wins]:[real] <col5>[Winning]:[span] }
SELECT SUM( "Wins" ) FROM `<table0>` WHERE "Winning span" = '2000–2010'
Which Wins have a Winning span of 2000 2010?
<table0>[table_name_57] { <col0>[born_in_other_eu_state__millions]:[INTEGER] <col1>[total_foreign_born__millions]:[VARCHAR] <col2>[total_population__millions]:[VARCHAR] }
SELECT AVG( born_in_other_eu_state__millions_ ) FROM `<table0>` WHERE total_foreign_born__millions_ = 0.5 AND total_population__millions_ < 5.534
What was the average number of people born in other EU states in millions, when the total number of foreign-born people in millions was 0.5, and when the total population in millions was less than 5.534?
<table0>[table_10007452_3] { <col0>[fuel_propulsion]:[VARCHAR] <col1>[fleet_series__quantity]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE fleet_series__quantity_ = "310-329 ( 20 )"
what is the fuel propulsion where the fleet series (quantity) is 310-329 (20)?
<table0>[job_history] { <col0>[EMPLOYEE_ID]:[decimal] <col1>[START_DATE]:[date] <col2>[END_DATE]:[date] <col3>[JOB_ID]:[varchar] <col4>[DEPARTMENT_ID]:[decimal] } <table1>[regions] { <col0>[REGION_ID]:[decimal] <col1>[REGION_NAME]:[varchar] } <table2>[jobs] { <col0>[JOB_ID]:[varchar] <col1>[JOB_TITLE]:[varchar] <col2...
SELECT SALARY, `<col10>` FROM `<table3>` WHERE NOT `<col10>` IN ( SELECT `<col10>` FROM `<table6>` WHERE `<col9>` BETWEEN 100 AND 200 )
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the correlation between salary and department_id in a scatter chart.
<table0>[course_offering] { <col0>[offering_id]:[int] <col1>[course_id]:[int] <col2>[semester]:[int] <col3>[section_number]:[int] <col4>[start_time]:[time] <col5>[end_time]:[time] <col6>[monday]:[varchar] <col7>[tuesday]:[varchar] <col8>[wednesday]:[varchar] <col9>[thursday]:[varchar] <col10>[friday]:[varchar] <col11>[...
SELECT COUNT( DISTINCT COURSE_1.department, COURSE_0.number ) FROM `<table8>` AS COURSE_0, `<table8>` AS COURSE_1, `<table8>`_prerequisite, student_record WHERE COURSE_0.`<table8>`_id = `<table8>`_prerequisite.pre_`<table8>`_id AND COURSE_1.`<table8>`_id = `<table8>`_prerequisite.`<table8>`_id AND COURSE_1.department =...
What number of the prerequisites for MACROMOL 512 have I met ?
<table0>[course_offering] { <col0>[offering_id]:[int] <col1>[course_id]:[int] <col2>[semester]:[int] <col3>[section_number]:[int] <col4>[start_time]:[time] <col5>[end_time]:[time] <col6>[monday]:[varchar] <col7>[tuesday]:[varchar] <col8>[wednesday]:[varchar] <col9>[thursday]:[varchar] <col10>[friday]:[varchar] <col11>[...
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'ANTHRBIO' AND course.number = 161 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offeri...
Can you tell me who the teacher is for ANTHRBIO 161 ?
<table0>[Projects] { <col0>[project_id]:[INT] <col1>[start_date]:[DATE] <col2>[end_date]:[DATE] <col3>[material_cost]:[FLOAT] }
SELECT SUM( `<col3>` ) FROM `<table0>` WHERE `<col1>` < `<col2>` AND `<col1>` >= '2021-01-01' AND `<col2>` < '2022-01-01' AND `<col3>` > 0;
What is the total cost of sustainable building materials for projects that started in 2021 and lasted more than 3 months?
<table0>[table_204_501] { <col0>[number]:[institution] <col1>[text]:[location] <col2>[text]:[nickname] <col3>[text]:[founded] <col4>[number]:[type] <col5>[text]:[enrollment] <col6>[number]:[joined] }
SELECT "nickname" FROM `<table0>` WHERE "nickname" IN ( 'v-hawks', 'mustangs' ) ORDER BY "enrollment" LIMIT 1
out of v hawks and mustangs , who has the least enrollment ?
<table0>[Products] { <col0>[Code]:[INTEGER] <col1>[VARCHAR]:[255] <col2>[Price]:[DECIMAL] <col3>[Manufacturer]:[INTEGER] } <table1>[Manufacturers] { <col0>[Code]:[INTEGER] <col1>[VARCHAR]:[255] <col2>[Headquarter]:[VARCHAR] <col3>[255]:[Founder] <col4>[VARCHAR]:[255] <col5>[Revenue]:[REAL] }
SELECT T1.Name, T1.Code FROM `<table0>` AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name DESC
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the sum of code , and group by attribute name, show bars in descending order.
<table0>[AssignedTo] { <col0>[Scientist]:[int] <col1>[Project]:[char] } <table1>[Projects] { <col0>[Code]:[Char] <col1>[Char]:[Hours] } <table2>[Scientists] { <col0>[SSN]:[int] }
SELECT T2.Name, COUNT( T2.Name ) FROM `<table0>` AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%' GROUP BY T2.Name
Find the name of the project for which a scientist whose name contains Smith is assigned to, and count them by a pie chart
<table0>[table_27268238_4] { <col0>[player]:[VARCHAR] <col1>[average]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "50.16"
If the average is 50.16, who is the player?
<table0>[table_name_92] { <col0>[overall]:[INTEGER] <col1>[pick]:[INTEGER] }
SELECT MIN( `<col0>` ) FROM `<table0>` WHERE `<col1>` < 2
what is the lowest overall when the pick is less than 2?
<table0>[table_name_7] { <col0>[home_team]:[VARCHAR] }
SELECT `<col0>` AS score FROM `<table0>` WHERE `<col0>` = "fitzroy"
In fitzroy's match where they were the home team, how much did they score?
<table0>[d_icd_procedures] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table1>[diagnoses_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table2>[admissions] { <col0>[...
SELECT `<table14>`.label FROM `<table14>` WHERE `<table14>`.itemid IN ( SELECT t1.itemid FROM ( SELECT `<table13>`.itemid, DENSE_RANK( ) OVER ( ORDER BY COUNT( * ) DESC ) AS c1 FROM `<table13>` WHERE `<table13>`.hadm_id IN ( SELECT `<table2>`.hadm_id FROM `<table2>` WHERE `<table2>`.age BETWEEN 40 AND 49 ) AND STRFTIME...
what are the five most commonly taken lab tests for patients of age 40s in 2105?
<table0>[VoteTypes] { <col0>[number]:[text] } <table1>[ReviewTaskStates] { <col0>[number]:[text] <col1>[Description]:[text] } <table2>[PostTags] { <col0>[PostId]:[number] <col1>[TagId]:[number] } <table3>[Users] { <col0>[number]:[Reputation] <col1>[number]:[CreationDate] <col2>[time]:[DisplayName] <col3>[text]:[Last...
SELECT TIME_TO_STR( CreationDate, '%A' ) AS DOW, COUNT( Id ) FROM `<table3>` GROUP BY TIME_TO_STR( CreationDate, '%A' )
new users count by Day Of Week.
<table0>[table_name_39] { <col0>[projects_templates]:[VARCHAR] <col1>[test_impact_analysis]:[VARCHAR] <col2>[intellitrace]:[VARCHAR] <col3>[windows_phone_development]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col2>` = "no" AND `<col3>` = "yes" AND `<col1>` = "no"
Which Projects template has an IntelliTrace of no, and a Windows Phone development of yes, and a Test impact analysis of no?
<table0>[artists] { <col0>[INT]:[name] <col1>[VARCHAR]:[region] <col2>[VARCHAR]:[num_works] <col3>[INT]:[INSERT] }
SELECT name, MAX( num_works ) FROM `<table0>` WHERE region = 'Latin America' GROUP BY name;
Who are the most prolific painters in the Latin American art scene?
<table0>[table_203_562] { <col0>[number]:[state] <col1>[text]:[candidates] <col2>[number]:[elected] <col3>[number]:[total] <col4>[seats]:[assembly] <col5>[number]:[year] <col6>[election]:[number] }
SELECT "state" FROM `<table0>` WHERE "no. of elected" = 17
who elected 17 ?
<table0>[table_name_69] { <col0>[nationality]:[VARCHAR] <col1>[school_club_team]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "iowa state"
What Nationality is the Iowa State team?
<table0>[Manufacturing] { <col0>[INT]:[PRIMARY] <col1>[KEY]:[item_type] <col2>[VARCHAR]:[country] <col3>[VARCHAR]:[price] <col4>[DECIMAL]:[INSERT] }
SELECT AVG( price ) FROM `<table0>` WHERE item_type LIKE 'Men%' AND country = 'Italy';
What is the average retail price of men's clothing items produced in Italy?
<table0>[table_30241] { <col0>[Entrant]:[text] <col1>[Constructor]:[text] <col2>[Car]:[text] <col3>[Driver]:[text] <col4>[driver]:[text] <col5>[Rounds]:[text] }
SELECT "Driver" FROM `<table0>` WHERE "Entrant" = 'Belgian VW Club' AND "Co-driver" = 'Frédéric Miclotte'
who is the person that is part of the belgian vw club that works with fr d ric miclotte
<table0>[purchases] { <col0>[supplier_id]:[VARCHAR] <col1>[255]:[purchase_date] <col2>[DATE]:[quantity] <col3>[INT]:[INSERT] }
SELECT SUM( quantity ) FROM `<table0>` WHERE `<col0>` = 'Y' AND YEAR( purchase_date ) = 2022;
What is the total quantity of products sold to supplier Y in the year 2022?
<table0>[Rooms] { <col0>[RoomId]:[TEXT] <col1>[roomName]:[TEXT] <col2>[beds]:[INTEGER] <col3>[bedType]:[TEXT] <col4>[maxOccupancy]:[INTEGER] <col5>[basePrice]:[INTEGER] <col6>[decor]:[TEXT] } <table1>[Reservations] { <col0>[Code]:[INTEGER] <col1>[Room]:[TEXT] <col2>[CheckIn]:[TEXT] <col3>[CheckOut]:[TEXT] <col4>[Rate]...
SELECT decor, AVG( `<col5>` ) FROM `<table0>` GROUP BY `<col6>` ORDER BY `<col6>` DESC
Please use a bar chart to show the average price of the rooms in a different decor, list bars in descending order please.
<table0>[table_23180638_1] { <col0>[oricon_albums_chart]:[VARCHAR] <col1>[debut_sales__copies]:[INTEGER] }
SELECT `<col0>` FROM `<table0>` WHERE debut_sales__copies_ > 339333.011497678
Which charts had debut sales of of more than 339333.011497678?
<table0>[table_204_7] { <col0>[number]:[number] <col1>[date]:[text] <col2>[film]:[text] <col3>[gross]:[text] <col4>[places]:[text] }
SELECT "film" FROM `<table0>` GROUP BY "film" HAVING COUNT( * ) >= 2
which movies were number 1 for at least two consecutive weeks ?
<table0>[CLASS] { <col0>[CLASS_CODE]:[varchar] <col1>[CRS_CODE]:[varchar] <col2>[CLASS_SECTION]:[varchar] <col3>[CLASS_TIME]:[varchar] <col4>[CLASS_ROOM]:[varchar] <col5>[PROF_NUM]:[int] } <table1>[PROFESSOR] { <col0>[EMP_NUM]:[int] <col1>[DEPT_CODE]:[varchar] <col2>[PROF_OFFICE]:[varchar] <col3>[PROF_EXTENSION]:[varc...
SELECT SCHOOL_CODE, COUNT( * ) FROM `<table5>` AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY `<col2>`
Return a bar chart on what is the number of professors for different school?, and could you list by the bar from low to high?
<table0>[table_11122] { <col0>[Year]:[real] <col1>[Tournament]:[text] <col2>[Venue]:[text] <col3>[Result]:[text] <col4>[Extra]:[text] }
SELECT SUM( "Year" ) FROM `<table0>` WHERE "Venue" = 'budapest, hungary'
What year is the venue in budapest, hungary?
<table0>[course] { <col0>[course_id]:[int] <col1>[name]:[varchar] <col2>[department]:[varchar] <col3>[number]:[varchar] <col4>[credits]:[varchar] <col5>[advisory_requirement]:[varchar] <col6>[enforced_requirement]:[varchar] <col7>[description]:[varchar] <col8>[num_semesters]:[int] <col9>[num_enrolled]:[int] <col10>[has...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.`<table5>` < ( SELECT SEMESTERalias0.`<table5>`_id FROM `<table5>` AS SEMESTERalias0 WHERE SEMESTERalias0.`<table5>` = 'WN' AND SEMESTERalias0.year = 2016 ) AND course.course...
Are there any classes Dr. Stefan Cieply has taught before ?
<table0>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table1>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text]...
SELECT `<table1>`.dob, `<table1>`.diagnosis FROM `<table1>` WHERE `<table1>`.name = "Mary Davis"
specify the birthdate and primary disease of patient mary davis
<table0>[language_preservation] { <col0>[INT]:[PRIMARY] <col1>[KEY]:[name] <col2>[TEXT]:[location] }
INSERT INTO language_preservation ( id, name, location ) VALUES ( 1, 'Mixtec Language', 'Mexico' );
Add a new language preservation project in 'Mexico'
<table0>[PostTypes] { <col0>[number]:[text] } <table1>[PendingFlags] { <col0>[number]:[FlagTypeId] <col1>[number]:[PostId] <col2>[number]:[CreationDate] <col3>[time]:[CloseReasonTypeId] <col4>[number]:[CloseAsOffTopicReasonTypeId] <col5>[number]:[DuplicateOfQuestionId] <col6>[number]:[BelongsOnBaseHostAddress] } <tab...
SELECT u.Id AS "user_link", u.DisplayName, u.Reputation, COUNT( p.Id ) AS "posts_count", ( CAST( u.Reputation AS FLOAT ) / CAST( COUNT( p.Id ) AS FLOAT ) ) AS "ratio" FROM `<table23>` AS u LEFT JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE ( p.PostTypeId = 1 OR p.PostTypeId = 2 ) AND u.Id = '##UserId:int##' GROUP BY u....
User's reputation per answers and questions count ratio. To find users with the maximum ratio, go here: https://data.stackexchange.com/unix/query/384545/users-with-the-highest-reputation-per-answers-and-questions-count-ratio
<table0>[MonthlyRevenue] { <col0>[restaurant_id]:[INT] <col1>[month]:[INT] <col2>[year]:[INT] <col3>[revenue]:[INT] }
SELECT AVG( `<col3>` ) FROM `<table0>` WHERE `<col0>` = 4 AND `<col2>` = 2021;
What is the average monthly revenue for 'Healthy Habits' in 2021?
<table0>[jobs] { <col0>[JOB_ID]:[varchar] <col1>[JOB_TITLE]:[varchar] <col2>[MIN_SALARY]:[decimal] <col3>[MAX_SALARY]:[decimal] } <table1>[job_history] { <col0>[EMPLOYEE_ID]:[decimal] <col1>[START_DATE]:[date] <col2>[END_DATE]:[date] <col3>[JOB_ID]:[varchar] <col4>[DEPARTMENT_ID]:[decimal] } <table2>[regions] { <col0...
SELECT EMPLOYEE_ID, `<col7>` FROM `<table4>` WHERE NOT `<col10>` IN ( SELECT `<col10>` FROM `<table6>` WHERE `<col9>` BETWEEN 100 AND 200 )
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the correlation between employee_id and salary in a scatter chart.
<table0>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table1>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[te...
SELECT `<table2>`.discharge_location, diagnoses.long_title FROM `<table2>` INNER JOIN diagnoses ON `<table2>`.hadm_id = diagnoses.hadm_id WHERE `<table2>`.name = "James Sloan"
provide me with the long title of diagnoses and location of discharge for patient james sloan.
<table0>[student] { <col0>[INT]:[program] <col1>[TEXT]:[gpa] <col2>[REAL]:[INSERT] }
SELECT MAX( gpa ) FROM `<table0>` WHERE program = 'cs';
What is the maximum GPA of graduate students in the 'cs' program?
<table0>[d_icd_diagnoses] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table1>[d_items] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] <col3>[linksto]:[text] } <table2>[inputevents_cv] { <col0>[row_id]:[number] <col1>[subject_id]:[n...
SELECT SUM( `<table6>`.`<table6>` ) FROM `<table6>` WHERE `<table6>`.hadm_id IN ( SELECT `<table9>`.hadm_id FROM `<table9>` WHERE `<table9>`.subject_id = 18677 ) AND DATETIME( `<table6>`.chargetime ) <= DATETIME( CURRENT_TIME( ), '-2 year' )
how much is patient 18677's total hospital bill during their stay until 2 years ago?
<table0>[Apartments] { <col0>[apt_id]:[INTEGER] <col1>[building_id]:[INTEGER] <col2>[apt_type_code]:[CHAR] <col3>[apt_number]:[CHAR] <col4>[bathroom_count]:[INTEGER] <col5>[bedroom_count]:[INTEGER] <col6>[room_count]:[CHAR] } <table1>[Apartment_Bookings] { <col0>[apt_booking_id]:[INTEGER] <col1>[apt_id]:[INTEGER] <col...
SELECT date_of_birth, COUNT( `<col4>` ) FROM `<table3>` WHERE `<col1>` = "Male" ORDER BY COUNT( `<col4>` )
What are the number of dates of birth of all the guests whose gender is 'Male'?, and sort Y in ascending order please.
<table0>[Dispensaries] { <col0>[INT]:[name] <col1>[TEXT]:[state] } <table1>[Waste] { <col0>[INT]:[dispensary_id] <col1>[INT]:[waste_weight] <col2>[INT]:[waste_date] }
SELECT D.name, SUM( W.waste_weight ) FROM `<table0>` D JOIN Waste W ON D.id = W.dispensary_id WHERE D.state = 'Washington' AND W.waste_date >= DATE_SUB( CURDATE( ), INTERVAL 1 MONTH ) GROUP BY D.id;
What is the total weight of cannabis waste generated by each dispensary in Washington in the last month?
<table0>[Student_Tests_Taken] { <col0>[registration_id]:[INTEGER] <col1>[date_test_taken]:[DATETIME] <col2>[test_result]:[VARCHAR] } <table1>[Courses] { <col0>[course_id]:[INTEGER] <col1>[author_id]:[INTEGER] <col2>[subject_id]:[INTEGER] <col3>[course_name]:[VARCHAR] <col4>[120]:[course_description] <col5>[VARCHAR]:[2...
SELECT date_of_completion, COUNT( `<col4>` ) FROM `<table2>` AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY `<col4>` ORDER BY COUNT( `<col4>` ) DESC
What are the number of the completion dates of all the tests that have result 'Fail'?, and rank from high to low by the y-axis.
<table0>[d_items] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] <col3>[linksto]:[text] } <table1>[cost] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[event_type]:[text] <col4>[event_id]:[number] <col5>[chargetime]:[time] } <table2>[d_labitems] { <col0>[...
SELECT AVG( `<table9>`.valuenum ) FROM `<table9>` WHERE `<table9>`.hadm_id IN ( SELECT `<table15>`.hadm_id FROM `<table15>` WHERE `<table15>`.subject_id = 5828 ) AND `<table9>`.itemid IN ( SELECT `<table2>`.itemid FROM `<table2>` WHERE `<table2>`.label = 'mch' ) GROUP BY STRFTIME( '%y-%m', `<table9>`.charttime )
what is the monthly average value of patient 5828's mch?
<table0>[Author] { <col0>[integer]:[text] <col1>[Affiliation]:[text] } <table1>[Conference] { <col0>[integer]:[ShortName] <col1>[text]:[FullName] <col2>[text]:[HomePage] } <table2>[Journal] { <col0>[integer]:[ShortName] <col1>[text]:[FullName] <col2>[text]:[HomePage] } <table3>[Paper] { <col0>[integer]:[Title] <col1...
SELECT T2.ShortName, T2.FullName FROM `<table3>` AS T1 INNER JOIN Journal AS T2 ON T1.JournalId = T2.Id WHERE T1.Keyword LIKE '%Materials%'
What is the journal's short and full names that feature papers on the "Materials" topic?
<table0>[table_21146729_6] { <col0>[title]:[VARCHAR] <col1>[writer_s]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE writer_s_ = "Jack Turley"
what is the title when the writer(s) is jack turley?
<table0>[table_52214] { <col0>[Year]:[real] <col1>[Theme]:[text] <col2>[Artist]:[text] <col3>[Mintage]:[text] <col4>[Issue]:[Price] }
SELECT "Artist" FROM `<table0>` WHERE "Year" < '2002' AND "Mintage" = '41,828'
What artist had a mintage of 41,828 before year 2002?
<table0>[requirement] { <col0>[requirement_id]:[int] } <table1>[student_record] { <col0>[student_id]:[int] <col1>[course_id]:[int] <col2>[semester]:[int] <col3>[grade]:[varchar] <col4>[varchar]:[transfer_source] <col5>[varchar]:[earn_credit] <col6>[varchar]:[repeat_term] <col7>[varchar]:[test_id] } <table2>[instructo...
SELECT DISTINCT `<table15>`.department, `<table15>`.name, `<table15>`.number FROM `<table15>` INNER JOIN program_`<table15>` ON program_`<table15>`.`<table15>`_id = `<table15>`.`<table15>`_id WHERE `<table15>`.credits = 4 AND program_`<table15>`.category LIKE 'ULCS'
Of all the upper-level classes , what classes involve 4 credits ?
<table0>[rural_infrastructure_projects] { <col0>[INT]:[project_name] <col1>[VARCHAR]:[255] <col2>[location]:[VARCHAR] <col3>[255]:[sector] <col4>[VARCHAR]:[255] <col5>[cost]:[FLOAT] }
INSERT INTO rural_infrastructure_projects ( project_name, location, sector, cost ) VALUES ( 'Waste Management System', 'Village E', 'Infrastructure', 60000.00 ) RETURNING id;
Insert a new rural infrastructure project with the given details and assign it a unique id.
<table0>[workforce_diversity] { <col0>[INT]:[gender_group] <col1>[VARCHAR]:[num_employees] }
DELETE FROM `<table0>` WHERE gender_group = 'Asian';
Delete records from the 'workforce_diversity' table for the 'Asian' gender group
<table0>[table_9878] { <col0>[Week]:[real] <col1>[Date]:[text] <col2>[Opponent]:[text] <col3>[Result]:[text] <col4>[Record]:[text] <col5>[Attendance]:[text] }
SELECT "Date" FROM `<table0>` WHERE "Week" < '14' AND "Record" = '7-1'
On what Date prior to Week 14 was the Record 7-1?
<table0>[table_name_7] { <col0>[conference_record]:[VARCHAR] <col1>[year]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "1971"
What is the conference record for the year of 1971?
<table0>[table_204_312] { <col0>[number]:[stage] <col1>[text]:[date] <col2>[text]:[route] <col3>[text]:[terrain] <col4>[text]:[length] <col5>[text]:[winner] }
SELECT "length" FROM `<table0>` WHERE "stage" = '3'
what was the total length listed for stage 3 ?
<table0>[Weather] { <col0>[location]:[VARCHAR] <col1>[255]:[date] <col2>[DATE]:[temperature] <col3>[INT]:[humidity] <col4>[INT]:[INSERT] } <table1>[Crops] { <col0>[INT]:[location] <col1>[VARCHAR]:[255] <col2>[crop_type]:[VARCHAR] <col3>[255]:[INSERT] }
SELECT AVG( w.temperature ) AS avg_temperature, AVG( w.humidity ) AS avg_humidity FROM `<table0>` w INNER JOIN Crops c ON w.location = c.location WHERE c.crop_type IS NOT NULL AND w.date BETWEEN '2022-07-01' AND '2022-07-31' AND c.location = 'France';
What is the average temperature and humidity for all crops in France in July?
<table0>[Movie] { <col0>[title]:[VARCHAR] <col1>[YEAR]:[INTEGER] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = ( SELECT MAX( `<col1>` ) FROM `<table0>` )
What is the name of the most recent movie?
<table0>[locations] { <col0>[LOCATION_ID]:[decimal] <col1>[STREET_ADDRESS]:[varchar] <col2>[POSTAL_CODE]:[varchar] <col3>[CITY]:[varchar] <col4>[STATE_PROVINCE]:[varchar] <col5>[COUNTRY_ID]:[varchar] } <table1>[job_history] { <col0>[EMPLOYEE_ID]:[decimal] <col1>[START_DATE]:[date] <col2>[END_DATE]:[date] <col3>[JOB_ID...
SELECT JOB_ID, COUNT( `<col6>` ) FROM `<table5>` WHERE `<col7>` BETWEEN 8000 AND 12000 AND `<col8>` <> "null" OR `<col10>` <> 40 GROUP BY `<col6>` ORDER BY COUNT( `<col6>` ) DESC
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find job_id and the amount of job_id , and group by attribute job_id, and visualize them by a bar chart, I want to show by the total number in descending.
<table0>[table_204_469] { <col0>[number]:[coach] <col1>[text]:[years] <col2>[text]:[seasons] <col3>[number]:[wins] <col4>[number]:[losses] <col5>[number]:[ties] <col6>[number]:[pct] }
SELECT ( SELECT "wins" FROM `<table0>` WHERE "coach" = 'mack erwin' ) > ( SELECT "wins" FROM `<table0>` WHERE "coach" = 'fred montsdeoca' )
does mack erwin have more or less wins than fred montsdeoca ?
<table0>[military_innovation] { <col0>[INT]:[project_name] <col1>[VARCHAR]:[year] <col2>[INT]:[budget] }
SELECT year, COUNT( * ) FROM `<table0>` WHERE location LIKE '%Americas%' AND year >= 2015 GROUP BY year;
How many military innovation projects were conducted in the Americas each year since 2015?
<table0>[table_name_90] { <col0>[date]:[VARCHAR] <col1>[venue]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "windy hill"
When was Windy Hill used as a venue?
<table0>[table_21443] { <col0>[1st]:[throw] <col1>[real]:[2nd] <col2>[throw]:[real] <col3>[3rd]:[throw] <col4>[real]:[Equation] <col5>[text]:[Result] }
SELECT MAX( "2nd throw" ) FROM `<table0>` WHERE "Equation" = '6 × 9² + 6 × 9 + 6'
If the equation is 6 9 + 6 9 + 6, what is the 2nd throw?
<table0>[smart_contracts] { <col0>[INT]:[name] <col1>[VARCHAR]:[description] <col2>[VARCHAR]:[creation_date] <col3>[DATE]:[INSERT] }
SELECT name, description FROM `<table0>` WHERE YEAR( creation_date ) = 2021;
Display the name and description of all smart contracts created in the year 2021
<table0>[MEMBER_OF] { <col0>[DNO]:[VARCHAR] } <table1>[DEPARTMENT] { <col0>[DName]:[VARCHAR] <col1>[DNO]:[VARCHAR] }
SELECT T1.DName FROM `<table1>` AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT( * ) LIMIT 1
Find the name of the department that has the fewest members.
<table0>[PostTags] { <col0>[PostId]:[number] <col1>[TagId]:[number] } <table1>[Posts] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[O...
WITH Raw AS ( SELECT Q.Id AS QId, A.Id AS AId, Votes.Id AS VoteId FROM `<table1>` AS Q INNER JOIN `<table1>` AS A ON Q.Id = A.ParentId LEFT JOIN Votes ON Votes.PostId = A.Id WHERE Q.OwnerUserId = '##UserId:int##' AND Q.Score < 0 AND A.OwnerUserId != '##UserId##' ) SELECT QId FROM Raw WHERE NOT VoteId IS NULL
Your downvoted questions what you can't delete. Buggy - after the daily mirror is ready, I will be able to fix it
<table0>[table_1341865_23] { <col0>[district]:[VARCHAR] <col1>[incumbent]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "Philip Philbin"
Name the district with philip philbin
<table0>[table_name_79] { <col0>[player]:[VARCHAR] <col1>[draft]:[VARCHAR] <col2>[round]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` < 1975 AND `<col2>` < 6
Which player had a draft before 1975 and before round 6?
<table0>[table_name_48] { <col0>[opponent]:[VARCHAR] <col1>[date]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "september 29"
Who plays on the date september 29?
<table0>[Boroughs] { <col0>[BoroughID]:[INT] <col1>[BoroughName]:[VARCHAR] } <table1>[Properties] { <col0>[PropertyID]:[INT] <col1>[Bedrooms]:[INT] <col2>[PropertyType]:[VARCHAR] <col3>[255]:[BoroughID] <col4>[INT]:[INSERT] <col5>[Boroughs]:[VALUES] <col6>[Queens]:[INSERT] }
SELECT AVG( `<col1>` ) FROM `<table1>` p JOIN `<col5>` b ON p.BoroughID = b.BoroughID WHERE p.PropertyType = 'Condo' AND b.BoroughName = 'Queens';
What is the average number of bedrooms for condos in the 'Queens' borough?
<table0>[HiringData] { <col0>[HireID]:[INT] <col1>[EmployeeID]:[INT] <col2>[HireDate]:[DATE] }
SELECT EXTRACT( MONTH FROM `<col2>` ) AS Month, COUNT( * ) AS NewHires FROM `<table0>` WHERE `<col2>` BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY Month;
How many new employees were hired in each month of 2022?
<table0>[d_labitems] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] } <table1>[prescriptions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[startdate]:[time] <col4>[enddate]:[time] <col5>[drug]:[text] <col6>[dose_val_rx]:[text] <col7>[dose_unit_rx]:[text]...
SELECT t2.drug FROM ( SELECT admissions.subject_id, `<table2>`.charttime FROM `<table2>` JOIN admissions ON `<table2>`.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 79348 AND `<table2>`.icd9_code = ( SELECT `<table3>`.icd9_code FROM `<table3>` WHERE `<table3>`.short_title = 'chf nos' ) AND DATETIME( `<tabl...
what is the name of the drug that patient 79348 was prescribed after the chf nos diagnosis in 08/this year, within 2 days?
<table0>[WorkoutData] { <col0>[UserID]:[INT] <col1>[WorkoutDate]:[DATE] <col2>[AvgHeartRate]:[INT] }
SELECT AVG( `<col2>` ) FROM `<table0>` WHERE `<col1>` >= '2022-03-01' AND `<col1>` <= '2022-03-31';
What is the average heart rate for users during their workouts in the month of March 2022?
<table0>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table1>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text]...
SELECT MAX( `<table1>`.age ) FROM `<table1>` WHERE `<table1>`.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND `<table1>`.admityear >= "2150"
Calculate the maximum age of patients admitted on or after 2150 who had a primary disease called aortic insufficiency/re-do sternotomy (aortic valve replacement).
<table0>[table_name_41] { <col0>[away_team]:[VARCHAR] }
SELECT `<col0>` AS score FROM `<table0>` WHERE `<col0>` = "carlton"
What was the away score for Carlton?
<table0>[table_name_65] { <col0>[date]:[VARCHAR] <col1>[attendance]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "40,000"
What date was the game when 40,000 attended?
<table0>[ev_cars_2] { <col0>[car_id]:[INT] <col1>[car_name]:[VARCHAR] <col2>[255]:[horsepower] <col3>[INT]:[model_year] }
SELECT t1.car_name, t1.horsepower, t1.model_year, t1.horsepower - t2.horsepower as horsepower_increase FROM `<table0>` t1 JOIN `<table0>` t2 ON t1.car_name = t2.car_name AND t1.model_year = t2.model_year + 1 WHERE t1.horsepower > t2.horsepower ORDER BY horsepower_increase DESC;
Show the electric vehicles that have had the most considerable increase in horsepower compared to their first model year
<table0>[Farmers] { <col0>[INT]:[name] <col1>[VARCHAR]:[255] <col2>[location]:[VARCHAR] } <table1>[Farmer_Crops] { <col0>[farmer_id]:[INT] <col1>[crop_type]:[VARCHAR] <col2>[255]:[area] <col3>[FLOAT]:[INSERT] <col4>[Farmers]:[name] <col5>[location]:[VALUES] <col6>[Farmer]:[India] <col7>[Farmer]:[India] <col8>[Farmer]:...
SELECT f.name, SUM( fc.area ) as total_area FROM `<table0>` f INNER JOIN Farmer_Crops fc ON f.id = fc.farmer_id GROUP BY f.name ORDER BY total_area DESC LIMIT 3;
Who are the top 3 farmers in India by total area of crops?
<table0>[treatment] { <col0>[treatmentid]:[number] <col1>[patientunitstayid]:[number] <col2>[treatmentname]:[text] <col3>[treatmenttime]:[time] } <table1>[medication] { <col0>[medicationid]:[number] <col1>[patientunitstayid]:[number] <col2>[drugname]:[text] <col3>[dosage]:[text] <col4>[routeadmin]:[text] <col5>[drugst...
SELECT 24 * ( STRFTIME( '%j', CURRENT_TIME( ) ) - STRFTIME( '%j', `<table7>`.hospitaladmittime ) ) FROM `<table7>` WHERE `<table7>`.uniquepid = '011-55642' AND `<table7>`.hospitaldischargetime IS NULL
how many hours have elapsed since patient 011-55642 was admitted to the hospital?
<table0>[PostTags] { <col0>[PostId]:[number] <col1>[TagId]:[number] } <table1>[Badges] { <col0>[number]:[UserId] <col1>[number]:[text] <col2>[Date]:[time] <col3>[Class]:[number] <col4>[TagBased]:[boolean] } <table2>[ReviewTasks] { <col0>[number]:[ReviewTaskTypeId] <col1>[number]:[CreationDate] <col2>[time]:[DeletionD...
SELECT * FROM ( SELECT OwnerUserId AS "user_link", COUNT( `<table28>`.Id ) AS Questions, CAST( AVG( CAST( Score AS FLOAT ) ) AS FLOAT( 6, 2 ) ) AS "average_question_score" FROM `<table28>` WHERE PostTypeId = 1 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL GROUP BY OwnerUserId ORDER BY COUNT( `<table28>`.Id ) DE...
Worst 100 Askers from the top 1500 by question count on the site. A list of the bottom 100 askers of questions ordered by average answer score excluding community wiki / closed posts, from the top 1500 by question count
<table0>[table_3137] { <col0>[Rank]:[real] <col1>[Team]:[text] <col2>[Round1]:[real] <col3>[Round2]:[real] <col4>[Round3]:[real] <col5>[Round4]:[real] <col6>[Total]:[points] }
SELECT MAX( "Round1" ) FROM `<table0>` WHERE "Total points" = '132'
How many points did the team who had 132 total points have in round 1?
<table0>[Documents] { <col0>[Document_ID]:[INTEGER] <col1>[Document_Type_Code]:[CHAR] <col2>[Project_ID]:[INTEGER] <col3>[Document_Date]:[DATETIME] <col4>[Document_Name]:[VARCHAR] <col5>[255]:[Document_Description] <col6>[VARCHAR]:[255] <col7>[Other_Details]:[VARCHAR] } <table1>[Statements] { <col0>[Statement_ID]:[INT...
SELECT Document_Date, COUNT( Document_Date ) FROM `<table4>` AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY `<col1>` ORDER BY Document_Date
How many documents are created in each day? Bin the document date by year interval and group by document type with a group line chart, I want to show Document_Date in ascending order please.
<table0>[climate_finance_orgs] { <col0>[org_id]:[INT] <col1>[org_name]:[VARCHAR] <col2>[region]:[VARCHAR] <col3>[renewable_energy_investment]:[INT] } <table1>[renewable_energy_projects] { <col0>[project_id]:[INT] <col1>[project_name]:[VARCHAR] <col2>[region]:[VARCHAR] <col3>[org_id]:[INT] }
SELECT org_name, COUNT( `<col0>` ) FROM `<table1>` JOIN climate_finance_orgs ON `<table1>`.org_id = climate_finance_orgs.org_id GROUP BY org_name ORDER BY COUNT( `<col0>` ) DESC;
Which climate finance organizations have invested in the most renewable energy projects in North America?
<table0>[circular_economy_initiatives] { <col0>[region]:[VARCHAR] <col1>[255]:[initiative_cost] <col2>[INT]:[date] <col3>[DATE]:[INSERT] }
SELECT region, date, SUM( initiative_cost ) OVER ( PARTITION BY date ORDER BY date DESC ) as total_initiative_cost FROM `<table0>` WHERE `<col0>` = 'Midwest';
What is the total initiative cost for circular economy initiatives, in the Midwest region, per day, in descending order?