The AND keyword
Coddy SQL 여정의 기초 섹션에 포함된 레슨 — 72개 중 6번째.
AND 키워드는 두 조건이 모두 참이어야 함을 의미합니다. 둘 중 하나라도 참이 아니면 조건이 충족되지 않습니다.
예를 들어 <b>people</b> 테이블이 있습니다:
| name | age | gender |
|---|---|---|
| Joas | 13 | male |
| Holwa | 17 | male |
| Nohlas | 24 | female |
| Polar | 23 | male |
| Loopa | 18 | female |
다음 쿼리는 다음과 같습니다:
SELECT *
FROM people
WHERE gender = "female" AND age < 20는 gender가 "female"이고 age가 20 미만인 모든 레코드를 찾고 있음을 의미합니다.
결과는 다음과 같습니다:
| name | age | gender |
|---|---|---|
| Loopa | 18 | female |
참고: SQL에서 문자열 값은 큰따옴표 "female" 또는 작은따옴표 'female'로 작성할 수 있으며, 대부분의 SQL 데이터베이스에서 두 가지 모두 허용됩니다.
챌린지
쉬움사용 가능한 테이블 및 컬럼:
people:name,age,status테이블: people
name age status Charles 28 employed Fatima 38 unemployed Eric 11 unemployed Diya 44 employed Hanna 22 employed Ali 20 unemployed Gabriel 37 employed Beatriz 17 employed Troy 29 unemployed Angelica 32 employed
people 테이블에서 나이가 20세 이상 28세 이하(20세 및 28세 포함)인 모든 사람을 조회하세요.
직접 해보기
SELECT *
FROM people
-- 아래에 코드를 작성하세요
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