Sorting Records by Constraints in Standard Queries
Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.
Sorting lets you control the order in which query results are returned. To sort records in a Standard table, place the sort keywords between the find conditions and the limit in your query:
[vehicles] <make "Chevy", SORT BY model ASC, LIMIT 5>
Combine SORT BY with LIMIT to efficiently retrieve a ranked subset of records — for example, the five most recent entries or the top-priced items.
⌘I
{"docsConfig":{"theme":"almond","$schema":"https://mintlify.com/docs.json","name":"Standard Computers","colors":{"primary":"#e7830a","light":"#2b7b5c","dark":"#151717"},"favicon":{"light":"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png","dark":"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png"},"background":{"decoration":"grid"},"navbar":{"links":[{"href":"https://standardcomputers.net/start","label":"Start"}],"primary":{"type":"button","label":"Login","href":"https://standardcomputers.net/login"}},"footer":{"socials":{"github":"https://github.com/standard-computers","x":"https://x.com/stndrdcomputers"}},"fonts":{"family":"Inter"},"contextual":{"options":["download-pdf","chatgpt","view","assistant","copy"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"standard-computers","hasAudioNarration":false,"actualSubdomain":"standard-computers","customDomains":["docs.standardcomputers.net"],"gitSource":{"type":"github","owner":"mintlify-community","repo":"docs-standard-computers-ffc9e4b1","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"collectionId":"abc705ac-8d30-43ac-a7af-43a489ae0478","liveDeploymentHistoryId":"6aa35afa865adcb1335aad94","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aa35afa865adcb1335aad94"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6aa35afa865adcb1335aad94","clientVersion":"0.0.3894","searchFilterCounts":[{"language":"default","tag":"Uses","count":32},{"language":"default","tag":"Documentation","count":31},{"language":"default","tag":"Code","count":8},{"language":"default","tag":"Language","count":8},{"language":"default","tag":"Records","count":7},{"language":"default","tag":"Functionality","count":5},{"language":"default","tag":"Get Started","count":5},{"language":"default","tag":"Standards","count":5},{"language":"default","tag":"Interfaces","count":3},{"language":"default","tag":"Authentication","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"records/sorting","slug":"/records/sorting","pageMetadata":{"title":"Sorting Records by Constraints in Standard Queries","sidebarTitle":"Sorting","description":"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.","href":"/records/sorting"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{Card,CardGroup,CodeBlock,Heading,Tip}=_components;if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Sorting lets you control the order in which query results are returned. To sort records in a Standard table, place the sort keywords between the find conditions and the limit in your query:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`[vehicles] \u003cmake \"Chevy\", SORT BY model ASC, LIMIT 5>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`sort-keywords`,children:`Sort Keywords`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`ASC`,icon:`arrow-up-a-z`,children:_jsxs(_components.p,{children:[`Sort `,_jsx(_components.strong,{children:`Ascending`}),` — orders results from A to Z (or lowest to highest for numeric values).`]})}),_jsx(Card,{title:`DESC`,icon:`arrow-down-z-a`,children:_jsxs(_components.p,{children:[`Sort `,_jsx(_components.strong,{children:`Descending`}),` — orders results from Z to A (or highest to lowest for numeric values).`]})})]}),`\n`,_jsx(Heading,{level:`2`,id:`syntax`,children:`Syntax`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`...SORT BY const_name [ASC || DESC]...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Combine `,_jsx(_components.code,{children:`SORT BY`}),` with `,_jsx(_components.code,{children:`LIMIT`}),` to efficiently retrieve a ranked subset of records — for example, the five most recent entries or the top-priced items.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Sorting Records by Constraints in Standard Queries","sidebarTitle":"Sorting","description":"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.","href":"/records/sorting"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Sort Keywords","slug":"sort-keywords","depth":2,"children":[]},{"title":"Syntax","slug":"syntax","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"standard-computers","siteName":"Standard Computers","title":"Sorting Records by Constraints in Standard Queries - Standard Computers","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-24T00:51:03.559Z","originalFileLocation":"records/sorting.mdx"},"headHtml":"\u003cmeta data-mint-head name=\"description\" content=\"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Standard Computers\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/png\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/png\" href=\"https://media.brand.dev/7e6a70c6-11b6-4689-acd7-c3ef84a3381f.png\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Sorting Records by Constraints in Standard Queries - Standard Computers\">\u003cmeta data-mint-head property=\"og:description\" content=\"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Standard Computers\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.standardcomputers.net/records/sorting\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Sorting Records by Constraints in Standard Queries - Standard Computers\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/standard-computers/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Standard Computers\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#e7830a\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.standardcomputers.net/records/sorting\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/records/sorting.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.standardcomputers.net/#organization\",\"name\":\"Standard Computers\",\"url\":\"https://docs.standardcomputers.net\"},{\"@type\":\"WebSite\",\"@id\":\"https://docs.standardcomputers.net#website\",\"name\":\"Standard Computers\",\"url\":\"https://docs.standardcomputers.net\",\"publisher\":{\"@id\":\"https://docs.standardcomputers.net/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.standardcomputers.net/records/sorting#webpage\",\"url\":\"https://docs.standardcomputers.net/records/sorting\",\"name\":\"Sorting Records by Constraints in Standard Queries\",\"description\":\"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.\",\"dateModified\":\"2026-07-24T00:51:03.559Z\",\"isPartOf\":{\"@id\":\"https://docs.standardcomputers.net#website\"},\"breadcrumb\":{\"@id\":\"https://docs.standardcomputers.net/records/sorting#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.standardcomputers.net/records/sorting#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Records\",\"item\":\"https://docs.standardcomputers.net/records/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sorting Records by Constraints in Standard Queries\",\"item\":\"https://docs.standardcomputers.net/records/sorting\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.standardcomputers.net/records/sorting#article\",\"headline\":\"Sorting Records by Constraints in Standard Queries\",\"name\":\"Sorting Records by Constraints in Standard Queries\",\"description\":\"Sort Standard query results using SORT BY with ASC or DESC ordering, combined with parameter filter conditions and a LIMIT clause.\",\"url\":\"https://docs.standardcomputers.net/records/sorting\",\"mainEntityOfPage\":{\"@id\":\"https://docs.standardcomputers.net/records/sorting#webpage\"},\"dateModified\":\"2026-07-24T00:51:03.559Z\",\"publisher\":{\"@id\":\"https://docs.standardcomputers.net/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.standardcomputers.net#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Standard Computers\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Standard Computers","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Get Started with Standard","sidebarTitle":"Overview","href":"/get-started/overview"},{"title":"Install Standard on Linux","sidebarTitle":"Install on Linux","href":"/get-started/install-linux"},{"title":"Install Standard on Windows","sidebarTitle":"Install on Windows","href":"/get-started/install-windows"},{"title":"Standard System Configuration","sidebarTitle":"Configuration","href":"/get-started/configuration"},{"title":"Standard System Command Reference","sidebarTitle":"Commands","href":"/get-started/commands"}]},{"group":"Infrastructure","pages":[{"title":"Set Up a Relay for Remote Access","sidebarTitle":"Relay","href":"/infrastructure/relay"},{"title":"Bulletins: Keeping Distributed Standard in Sync","sidebarTitle":"Bulletin","href":"/infrastructure/bulletin"}]},{"group":"Authentication","pages":[{"title":"Authenticate with Chits in the Standard System","sidebarTitle":"Chits","href":"/authentication/chits"},{"title":"License Plate Nonce: Device Identity in Standard","sidebarTitle":"License Plate Nonce","href":"/authentication/license-plate-nonce"}]},{"group":"Standards","pages":[{"title":"Standards Overview: Schema and Data Definitions in R1","sidebarTitle":"Overview","href":"/standards/overview"},{"title":"Constraints: Fields in a Standard","sidebarTitle":"Constraints","href":"/standards/constraints"},{"title":"Extend a Standard for Inheritance and Additions","sidebarTitle":"Extending Standards","href":"/standards/extending-standards"},{"title":"Standards as Constraints: Join and Traverse Related Records","sidebarTitle":"Standards as Constraints","href":"/standards/standards-as-constraints"},{"title":"Standard Definitions: Enumerations for Constraints","sidebarTitle":"Standard Definitions","href":"/standards/standard-definitions"}]},{"group":"Records","pages":[{"title":"Records: Querying and Managing Rows in Standard","sidebarTitle":"Overview","href":"/records/overview"},{"title":"In-Memory Records for Fast Temporary Data in Standard","sidebarTitle":"In-Memory","href":"/records/in-memory"},{"title":"Finding Records in Standard R1 with Queries and Filters","sidebarTitle":"Finding","description":"Query Standard records with exact matching, parameter-based filters, limits, and English-language conditions like GREATER THAN and CONTAINS.","href":"/records/finding"},{"title":"Sorting Records by Constraints in Standard Queries","sidebarTitle":"Sorting","href":"/records/sorting"},{"title":"Updating Records in a Standard Table by Constraint","sidebarTitle":"Updating","description":"Update one or many records in a Standard table by specifying a constraint name, a new value, and an optional filter query with LIMIT.","href":"/records/updating"},{"title":"Deleting Records from a Standard Table by Query","sidebarTitle":"Deleting","href":"/records/deleting"},{"title":"Import and Export Standard Records as JSON, XML, or CSV","sidebarTitle":"Import \u0026 Export","href":"/records/importing-exporting"}]},{"group":"Functionality","pages":[{"title":"Standard: A Unified Computing Platform","sidebarTitle":"Overview","href":"/functionality/overview"},{"title":"Standard Search: Records, Articles, and AI Queries","sidebarTitle":"Search","href":"/functionality/search"},{"title":"Standard Files: Index, Move, and Manage Your Files","sidebarTitle":"Files","href":"/functionality/files"},{"title":"Standard Intelligence: SIM and Ollama AI on Device","sidebarTitle":"Intelligence","href":"/functionality/intelligence"},{"title":"Use Standard as a Powerful Custom Database Backend","sidebarTitle":"Database","href":"/functionality/database"}]},{"group":"Interfaces","pages":[{"title":"Standard System WebSocket Server and Client Overview","sidebarTitle":"WebSocket","href":"/interfaces/websocket"},{"title":"Standard Node GUI: Access Your System from the Web","sidebarTitle":"Node GUI","href":"/interfaces/node-gui"},{"title":"Superuser: All Keyboard Shortcuts for Standard UI Apps","sidebarTitle":"Superuser","href":"/interfaces/superuser"}]},{"group":"Standard UI","pages":[{"title":"Introduction","href":"/uses/introduction"},{"title":"Automations","href":"/untitled-page"}]}]},{"tab":"Code","pages":[{"title":"Code","href":"/code/variables-types"}]},{"tab":"Uses","pages":[{"title":"Uses","href":"/use-cases"}]},{"tab":"Design"}]},"title":"Sorting Records by Constraints in Standard Queries - Standard Computers","buildId":"dpl_8LJVMfxYNq6LJkohTrn2iyWT8umj","deploymentId":"dpl_8LJVMfxYNq6LJkohTrn2iyWT8umj","dynamics":[],"chunks":[]}