语法上没有错误,但是建议将 SELECT 语句中的中文用英文替换,以避免可能出现的编码问题。同时,如果想要更好的可读性,可以加上 GROUP BY 语句,将结果按照婚姻状况和性别进行分组,如下所示:

SELECT 'Marital Status', 'Gender', COUNT('ID number') AS 'Number of People' FROM Personnel WHERE Marital Status = 'Married' AND Gender = 'Female' GROUP BY Marital Status, Gender;

SQL 查询优化:将中文替换为英文并使用 GROUP BY 语句

原文地址: https://www.cveoy.top/t/topic/okYu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录