๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Basic/[SQL] Leetcode ํ’€์ด๋…ธํŠธ

[LeetCode | Easy] 595. Big Countries

๐Ÿ”ป ๋ฌธ์ œ ๋งํฌ

https://leetcode.com/problems/big-countries/description/?envType=study-plan&id=sql-i 

 

Big Countries - LeetCode

Can you solve this real interview question? Big Countries - Table: World +-------------+---------+ | Column Name | Type | +-------------+---------+ | name | varchar | | continent | varchar | | area | int | | population | int | | gdp | int | +-------------+

leetcode.com

 

๐Ÿ”ป ๋ฌธ์ œ ํŒŒ์•…

area๊ฐ€ ์ตœ์†Œ 300,0000์ด๊ฑฐ๋‚˜, population์ด ์ตœ์†Œ 2500,0000์ธ ๋‚˜๋ผ๋ฅผ ์กฐํšŒํ•˜๋ฉด ๋œ๋‹ค.

์ฆ‰, ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•˜๋ฉด ๋œ๋‹ค.

 

๐Ÿ”ป ๋ฌธ์ œ ํ•ด๊ฒฐ

  • SELECT~ FROM ์œผ๋กœ ์กฐํšŒํ•  ํ–‰์„ ์„ ํƒ
  • WHERE๋กœ ์กฐ๊ฑด ์ž…๋ ฅ
    • A ์ด๊ฑฐ๋‚˜ B๋ฅผ ๋งŒ์กฑํ•ด์•ผํ•˜๊ธฐ ๋•Œ๋ฌธ์—, or๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
SELECT name, population, area
FROM World
WHERE (area >= 3000000) OR (population >= 25000000);