Multiple Conditions Combined
Coddy SQL 여정의 기초 섹션에 포함된 레슨 — 72개 중 9번째.
단 하나의 조건만으로 쿼리를 작성하는 것으로는 부족할 때가 있습니다. 때로는 더 복잡한 조건을 확인하고 싶을 수도 있습니다. 이를 위해 SQL(및 다른 많은 프로그래밍 언어)은 원하는 결과를 정확하게 가져올 수 있는 능력을 향상시켜 주는 AND, OR, NOT 키워드를 제공합니다.
AND 및 OR 키워드는 다음과 같이 사용됩니다:
SELECT col1, col2
FROM table1
WHERE condition1 AND condition2 OR condition3 ...원하는 만큼 많은 조건을 함께 쌓을 수 있습니다.
챌린지
쉬움사용 가능한 테이블 및 열:
<strong>candies</strong>:<strong>name</strong>,<strong>price</strong>,<strong>color</strong>,<strong>weight</strong>
다음 중 하나에 해당하는 모든 사탕을 찾는 쿼리를 작성하세요:
- `brown` 색상이고 가격이 2이거나 OR
- `mixed` 색상이고 무게가 40 미만인 사탕
쿼리는 이 사탕들의 `name`과 `color`만 반환해야 합니다.
직접 해보기
SELECT name, color
FROM candies
-- 아래에 코드를 작성하세요
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