AlibabaResearch / AlibabaResearch/DAMO-ConvAI

Corrected SQL for `shooting` dataset in train set for date.

Aperta
#216 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
1.6k
Fork
250
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.