AlibabaResearch / AlibabaResearch/DAMO-ConvAI

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

Abierto
#216 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
1.6k
Forks
250
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.