-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
Current entry:
{
"db_id": "shooting",
"question": "In which year has the greatest number of cases where Handgun was used as weapon?",
"evidence": "year refers to year(date); the greatest number of cases refers to max(count(case_number)); OS Spray was used as weapon refers to subject_weapon = 'OS Spray'",
"SQL": "SELECT STRFTIME('%Y', date) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY STRFTIME('%Y', date) ORDER BY COUNT(case_number) DESC LIMIT 1"
}
Output: null
This is because the date format is:
>> sqlite3 train/train_databases/shooting/shooting.sqlite "SELECT date from incidents LIMIT 10"
2015/2/9
2016/3/26
2016/4/16
2004/12/29
2007/2/12
2005/12/25
2006/2/11
2006/1/1
2008/4/18
2010/4/27
Suggested corrected SQL: "SELECT SUBSTR(date, 1, 4) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY SUBSTR(date, 1, 4) ORDER BY COUNT(case_number) DESC LIMIT 1"
>>> sqlite3 train/train_databases/shooting/shooting.sqlite "SELECT SUBSTR(date, 1, 4) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY SUBSTR(date, 1, 4) ORDER BY COUNT(case_number) DESC LIMIT 1"
2014
Metadata
Metadata
Assignees
Labels
No labels