Conditions Basics
Coddy SQL 여정의 기초 섹션에 포함된 레슨 — 72개 중 5번째.
때로는 특정 조건을 만족하는 레코드를 조회하고 싶을 때가 있습니다.
예를 들어
- 성이 "Aothly"인 모든 레코드를 가져옵니다.
amount가 5보다 큰 모든 레코드를 가져옵니다.
- 국가가 "Mexico"인 모든 레코드를 가져옵니다
조건을 추가하기 위해 WHERE 키워드를 사용할 수 있습니다
예를 들어, 다음은 sales 테이블입니다:
| coin | amount |
| AGK | 13 |
| GOL | 21 |
| KLA | 15 |
| AGK | 18 |
코인이 "AGK"인 모든 레코드를 가져오려면 다음과 같이 작성합니다:
SELECT * FROM sales
WHERE coin = 'AGK'amount가 20 이하인 모든 레코드를 가져오려면 다음과 같이 작성합니다:
SELECT * FROM sales
WHERE amount <= 20챌린지
쉬움사용 가능한 테이블 및 열:
<strong>events</strong>:<strong>event_id</strong>,<strong>people</strong>
people이 14 미만인 모든 event_id를 조회하세요.
직접 해보기
SELECT event_id FROM events
-- 아래에 코드를 작성하세요
WHERE이 레슨에는 짧은 퀴즈가 포함되어 있습니다. 레슨을 시작해 문제를 풀고 진행 상황을 기록하세요.
기초의 모든 레슨
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns