supersonic icon indicating copy to clipboard operation
supersonic copied to clipboard

[Enhancement] 结果展示和问题预期不符,例如:问题是X和Y的比例是多少,结果展示的是X和Y分类。

Open tedypeng opened this issue 6 months ago • 0 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Description

image LLM解析S2SQL

`SELECT CASE WHEN 性别 = '女' THEN '女性员工数' WHEN 性别 = '男' THEN '男性员工数' ELSE '其他' END AS 性别分类, COUNT() AS 员工数 FROM 员工数据集 GROUP BY 性别 ORDER BY COUNT() DESC;

Note: This SQL query will return the count of employees by gender, but to get the ratio of female to male employees, you would need to do additional calculations which SQL can't directly express in a single query without using a subquery or JOIN. However, as per your instructions, I've only responded with the converted SQL statement that provides the count by gender. If you need the ratio, please let me know, and I can provide a modified query.`

修正S2SQL

SELECT CASE WHEN 性别 = '女' THEN '女性员工数' WHEN 性别 = '男' THEN '男性员工数' ELSE '其他' END AS 性别分类, COUNT(*) FROM 员工数据集 GROUP BY 性别 ORDER BY COUNT(*) DESC

最终执行SQL SELECT CASE WHEN gender = '女' THEN '女性员工数' WHEN gender = '男' THEN '男性员工数' ELSE '其他' END AS 性别分类, COUNT(*) FROM ( SELECT gender, emp_noASemployees_internal_cnt FROM employees.employees ) t_6 GROUP BY gender ORDER BY COUNT(*) DESC limit 1000

Solution

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

tedypeng avatar Jul 30 '24 03:07 tedypeng