Conditions Basics
Coddy SQL 여정의 기초 섹션에 포함된 레슨 — 72개 중 5번째.
특정 조건을 만족하는 레코드를 가져오고 싶을 때가 있습니다.
예를 들어
- "Aothly" 성을 가진 모든 레코드를 가져오세요
- 금액이 5보다 큰 모든 레코드를 가져오기
- 국가 "Mexico"인 모든 레코드를 가져오기
조건을 추가하려면 WHERE 키워드를 사용할 수 있습니다
예를 들어 여기 판매 테이블이 있습니다:
| 코인 | 수량 |
| AGK | 13 |
| GOL | 21 |
| KLA | 15 |
| AGK | 18 |
coin이 "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>
모든 event_ids 중에서 people 이 14명 미만인 것을 가져오세요
치트 시트
WHERE 키워드를 사용하여 SQL 쿼리에 조건을 추가하세요:
SELECT * FROM table_name
WHERE column_name = 'value'숫자 비교의 경우:
SELECT * FROM table_name
WHERE column_name <= 20일반적인 비교 연산자: =, <, >, <=, >=
직접 해보기
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