显示最受欢迎的男性和女性名字
从名为 BabyName 的数据库中显示 1983 年最受欢迎的男性和女性名字
SELECT COUNT(name) "Most Popular M/F Names from 1983", name
FROM BabyName
GROUP BY name
ORDER BY year = '1983' AND COUNT(name) DESC
LIMIT 50
这是试图从 1983 年提取最受欢迎的男性和女性名字。这使用了名为 BabyName 的数据库及其一个相当大的数据库。 这是我想到的唯一方法,但我也觉得它是错误的,因为它要求最受欢迎的女性和男性名字。关于如何处理这个问题有什么建议吗?我无法显示数据库信息,因为它相当大,但它包含姓名、性别、出生年份和来自哪里。
Display the most popular male and female names from the year 1983 from the database named BabyName
SELECT COUNT(name) "Most Popular M/F Names from 1983", name
FROM BabyName
GROUP BY name
ORDER BY year = '1983' AND COUNT(name) DESC
LIMIT 50
This is trying to pull the most popular male and female names from the year 1983. This is using a database called babyname and its a fairly large database.
This is the only way I figured out but I also feel like its wrong because its asking for the most popular female and male names. Any suggestions on how you might approach this? I can't show the DB information because its fairly large but it contains the name, gender, year they were born and the place they are from.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 MariaDB 中,您可以使用窗口函数:
In MariaDB you can use window functions: