๐Ÿ’ SQL (Programmers)/Select

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][SQL] ํŠน์ • ๋ฌผ๊ณ ๊ธฐ๋ฅผ ์žก์€ ์ด ์ˆ˜ ๊ตฌํ•˜๊ธฐ (298518)

์„ ๋‹ฌ 2024. 10. 22. 16:37
๋ฐ˜์‘ํ˜•

๋ฌธ์ œ

FISH_INFO ํ…Œ์ด๋ธ”์—์„œ ์žก์€ BASS์™€ SNAPPER์˜ ์ˆ˜๋ฅผ ์ถœ๋ ฅํ•˜๋Š” SQL ๋ฌธ์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.

์ปฌ๋Ÿผ๋ช…์€ 'FISH_COUNT`๋กœ ํ•ด์ฃผ์„ธ์š”.

 

ํ’€์ด

select count(ID) as FISH_COUNT
from FISH_INFO
where FISH_TYPE in (
    select FISH_TYPE
    from FISH_NAME_INFO
    where FISH_NAME = 'BASS' or FISH_NAME = 'SNAPPER'
)
๋ฐ˜์‘ํ˜•