--- id: php-mysql-select-limit title: "PHP MySQL Select Limit" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["LIMIT OFFSET", "PHP MySQL κ²°κ³Ό μ œν•œ"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["php", "programming", "w3schools", "mysql", "limit"] raw_sources: ["https://www.w3schools.com/php/php_mysql_select_limit.asp"] applied_in: [] github_commit: "" --- # [[PHP MySQL Select Limit]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `LIMIT 15, 10` and `LIMIT 10 OFFSET 15` return the IDENTICAL result, but the numbers are REVERSED between the two forms β€” the comma syntax puts the offset first and count second, while the OFFSET keyword syntax puts count first and offset second, a subtle inversion the source explicitly flags to avoid confusion. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`LIMIT n`** β€” returns only the first `n` records. [S1] - **Purpose** β€” performance on large tables; avoids returning huge result sets unnecessarily. [S1] - **`LIMIT n OFFSET m`** β€” returns `n` records starting after skipping `m` records (i.e., starting at record m+1). [S1] - **Comma shorthand β€” `LIMIT m, n`** β€” same result as `LIMIT n OFFSET m`, but note the argument ORDER is reversed (offset first here, count first in the OFFSET form). [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - First 30 records: `$sql = "SELECT * FROM Orders LIMIT 30";`. [S1] - Records 16-25 via OFFSET: `$sql = "SELECT * FROM Orders LIMIT 10 OFFSET 15";` β€” "return only 10 records, start on record 16 (OFFSET 15)". [S1] - Same result via comma shorthand: `$sql = "SELECT * FROM Orders LIMIT 15, 10";` β€” note the numbers are reversed compared to the OFFSET form. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **콀마 λ¬Έλ²•μ˜ 숫자 μˆœμ„œ λ°˜μ „**: LIMIT n OFFSET mκ³Ό LIMIT m, n이 λ™μΌν•œ κ²°κ³Όλ₯Ό λ‚΄μ§€λ§Œ 숫자 μˆœμ„œκ°€ λ°˜λŒ€λΌλŠ” 점이 ν˜Όλ™ λ°©μ§€λ₯Ό μœ„ν•΄ λͺ…μ‹œμ μœΌλ‘œ 강쑰됨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” νŽ˜μ΄μ§€λ„€μ΄μ…˜(16~25번째 λ ˆμ½”λ“œ 쑰회)이 LIMIT+OFFSET ν™œμš©μ˜ λŒ€ν‘œ μ‹€μ „ 사둀닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Two equivalent syntaxes for the same paginated range, with reversed argument order (SQL): ```sql SELECT * FROM Orders LIMIT 10 OFFSET 15; -- 10 records starting at record 16 SELECT * FROM Orders LIMIT 15, 10; -- same result, numbers reversed ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[PHP Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[PHP MySQL Update]], [[PHP XML Parsers]] - **μ°Έμ‘° λ§₯락:** MySQL μ„Ήμ…˜μ˜ λ§ˆμ§€λ§‰ β€” XML νŒŒμ‹± μ„Ήμ…˜μœΌλ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” PHP MySQL Limit Data Selections β€” https://www.w3schools.com/php/php_mysql_select_limit.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "PHP MySQL Limit Data Selections" page (Astra wiki-curation, P-Reinforce v3.1 format).