Limit number of records
Coddy SQL 여정의 기초 섹션에 포함된 레슨 — 72개 중 16번째.
많은 데이터를 가져왔다고 가정해 보겠습니다. 때로는 상위 5개 또는 상위 10개의 레코드만 필요합니다.
레코드 수를 제한하려면 LIMIT 키워드를 사용할 수 있습니다
예를 들어
SELECT *
FROM table1
LIMIT 10이것은 상위 10개의 레코드를 반환합니다.
챌린지
쉬움사용 가능한 테이블 및 컬럼:
<strong>temperature</strong>:<strong>place_id</strong>,<strong>avg_temp</strong>
temperature 테이블에서 가장 추운 5곳을 가져오세요. 다음 단계를 따르세요:
- 결과를 오름차순으로 정렬하세요
- 결과를 5행으로 제한하세요
치트 시트
쿼리에서 반환되는 레코드 수를 제한하려면 LIMIT 키워드를 사용하세요:
SELECT *
FROM table1
LIMIT 10이것은 테이블에서 상위 10개의 레코드를 반환합니다.
직접 해보기
이 레슨에는 짧은 퀴즈가 포함되어 있습니다. 레슨을 시작해 문제를 풀고 진행 상황을 기록하세요.
기초의 모든 레슨
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