gpt4 book ai didi

mysql - SQL : how to find one specific data

转载 作者:行者123 更新时间:2023-11-29 09:49:24 26 4
gpt4 key购买 nike

我需要检索“最稀有”的动物,这意味着我只想显示在我的表格中只出现一次的动物。

例如:

1 Rat
2 Squirrel
3 Bat
4 Rat
5 Bat
6 Raccoon
7 Armadillo
8 Hamster
9 Rat
10 Hamster

我的输出会说:

Squirrel, Raccoon, Armadillo.

我的命令是这样开始的:

SELECT  breed FROM OtherAnimals;

最佳答案

使用条件聚合

    select breed 
from OtherAnimals
group by breed
having count(*)=1

关于mysql - SQL : how to find one specific data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55080485/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com