{"id":2303,"date":"2024-05-10T07:19:49","date_gmt":"2024-05-10T07:19:49","guid":{"rendered":"https:\/\/www.skillvertex.com\/blog\/?p=2303"},"modified":"2024-05-10T07:19:49","modified_gmt":"2024-05-10T07:19:49","slug":"which-sql-keyword-is-used-to-sort-the-result-set","status":"publish","type":"post","link":"https:\/\/www.skillvertex.com\/blog\/which-sql-keyword-is-used-to-sort-the-result-set\/","title":{"rendered":"Which SQL Keyword Is Used To Sort The Result-Set"},"content":{"rendered":"\n<p>a. SORT BY<\/p>\n\n\n\n<p>b. ORDER<\/p>\n\n\n\n<p>c. ORDER BY<\/p>\n\n\n\n<p>d. SORT<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Which SQL Keyword Is Used To Sort The Result-Set<\/h2>\n\n\n\n<p>Answer. Option B) Order By is the Correct Answer<\/p>\n\n\n\n<p>In SQL, the <code>ORDER BY<\/code> the keyword is used to sort the result set of a query. You can use it to specify one or more columns by which you want to sort the rows in the result set, and you can also specify the sort order, which can be ascending (ASC) or descending (DESC).<\/p>\n\n\n\n<p>Here&#8217;s the basic syntax of the <code>ORDER BY<\/code> clause:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT column1, column2, ...\nFROM table_name\nORDER BY column1 &#91;ASC | DESC], column2 &#91;ASC | DESC], ...;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>column1, column2, ...<\/code> specifies the columns you want to retrieve in the result set.<\/li>\n\n\n\n<li><code>table_name<\/code> is the name of the table from which you&#8217;re selecting data.<\/li>\n\n\n\n<li><code>ORDER BY<\/code> is followed by one or more column names by which you want to sort the result set. You can also specify the sort order as <code>ASC<\/code> (ascending) or <code>DESC<\/code> (descending).<\/li>\n<\/ul>\n\n\n\n<p>For example, if you want to retrieve records from a &#8220;employees&#8221; table and sort them by the &#8220;last_name&#8221; column in ascending order, you would use the following SQL query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT *\nFROM employees\nORDER BY last_name ASC;<\/code><\/pre>\n\n\n\n<p>This would return the rows sorted by the &#8220;last_name&#8221; column in alphabetical order.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>a. SORT BY b. ORDER c. ORDER BY d. SORT Which SQL Keyword Is Used To Sort The Result-Set Answer. Option B) Order By is the Correct Answer In SQL, the ORDER BY the keyword is used to sort the result set of a query. You can use it to specify one or more columns &#8230; <a title=\"Which SQL Keyword Is Used To Sort The Result-Set\" class=\"read-more\" href=\"https:\/\/www.skillvertex.com\/blog\/which-sql-keyword-is-used-to-sort-the-result-set\/\" aria-label=\"More on Which SQL Keyword Is Used To Sort The Result-Set\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":2306,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[413],"class_list":["post-2303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-which-sql-keyword-is-used-to-sort-the-result-set","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"_links":{"self":[{"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/posts\/2303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/comments?post=2303"}],"version-history":[{"count":1,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/posts\/2303\/revisions"}],"predecessor-version":[{"id":2307,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/posts\/2303\/revisions\/2307"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/media\/2306"}],"wp:attachment":[{"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/media?parent=2303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/categories?post=2303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skillvertex.com\/blog\/wp-json\/wp\/v2\/tags?post=2303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}