{"id":731,"date":"2018-07-31T15:23:32","date_gmt":"2018-07-31T08:23:32","guid":{"rendered":"http:\/\/www.sqlservertutorial.net\/?page_id=731"},"modified":"2024-09-24T20:59:37","modified_gmt":"2024-09-24T13:59:37","slug":"sql-server-select-top","status":"publish","type":"page","link":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/","title":{"rendered":"SQL Server SELECT TOP"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the SQL Server <code>SELECT TOP<\/code> statement to limit the rows returned by a query.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-sql-server-select-top'>Introduction to SQL Server SELECT TOP <a href=\"#introduction-to-sql-server-select-top\" class=\"anchor\" id=\"introduction-to-sql-server-select-top\" title=\"Anchor for Introduction to SQL Server SELECT TOP\">#<\/a><\/h2>\n\n\n\n<p>The <code>SELECT TOP<\/code> clause allows you to limit the rows or percentage of rows returned by a query. It is useful when you want to retrieve a specific number of rows from a large table.<\/p>\n\n\n\n<p>Since the order of rows stored in a table is <em>unspecified<\/em>, the <code>SELECT TOP<\/code> statement should always be used with the <code><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-order-by\/\">ORDER BY<\/a><\/code> clause. This ensures the result set is limited to the first <code>N<\/code> number of ordered rows.<\/p>\n\n\n\n<p>The following shows the syntax of the <code>TOP<\/code> clause with the <code>SELECT<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> TOP (expression) &#91;<span class=\"hljs-keyword\">PERCENT<\/span>]\n    &#91;<span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">TIES<\/span>]\n<span class=\"hljs-keyword\">FROM<\/span> \n    table_name\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \n    column_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax, the <code>SELECT<\/code> statement may include other clauses such as <code><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-where\/\">WHERE<\/a><\/code>, <code><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-joins\/\">JOIN<\/a><\/code>, and <code><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-group-by\/\">GROUP BY<\/a><\/code> and <code><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-having\/\">HAVING<\/a><\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='expression'>expression <a href=\"#expression\" class=\"anchor\" id=\"expression\" title=\"Anchor for expression\">#<\/a><\/h3>\n\n\n\n<p>Following the <code>TOP<\/code> keyword is an expression that specifies the number of rows to be returned. The expression is evaluated to a float value if <code>PERCENT<\/code> is used, otherwise, it is converted to a <code><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-int\/\">BIGINT<\/a><\/code> value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='percent'>PERCENT <a href=\"#percent\" class=\"anchor\" id=\"percent\" title=\"Anchor for PERCENT\">#<\/a><\/h3>\n\n\n\n<p>The <code>PERCENT<\/code> keyword indicates that the query returns the first <code>N<\/code> percentage of rows, where <code>N<\/code> is the result of the <code>expression<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='with-ties'>&nbsp;WITH TIES <a href=\"#with-ties\" class=\"anchor\" id=\"with-ties\" title=\"Anchor for &nbsp;WITH TIES\">#<\/a><\/h3>\n\n\n\n<p>The <code>WITH TIES<\/code> allows you to return additional rows with values that match those of the last row in the limited result set. Note that <code>WITH TIES<\/code> may result in more rows being returned than specified in the expression.<\/p>\n\n\n\n<p>For example, if you want to return the most expensive product, you can use the <code>TOP 1<\/code>. However, if two or more products have the same prices as the most expensive product, then you may miss the other most expensive products in the result set.<\/p>\n\n\n\n<p>To avoid this, you can use <code>TOP 1 WITH TIES<\/code>. This will include not only the most expensive product but also other products that have the same highest price. By doing this, you won&#8217;t miss any equally expensive products in the result set.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='sql-server-select-top-examples'>SQL Server SELECT TOP examples <a href=\"#sql-server-select-top-examples\" class=\"anchor\" id=\"sql-server-select-top-examples\" title=\"Anchor for SQL Server SELECT TOP examples\">#<\/a><\/h2>\n\n\n\n<p>We will use the <code>production.products<\/code> table in the <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-sample-database\/\">sample database<\/a> for the demonstration.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"206\" height=\"169\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/products.png\" alt=\"products\" class=\"wp-image-147\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id='1-using-sql-server-select-top-with-a-constant-value'>1) Using SQL Server SELECT TOP with a constant value <a href=\"#1-using-sql-server-select-top-with-a-constant-value\" class=\"anchor\" id=\"1-using-sql-server-select-top-with-a-constant-value\" title=\"Anchor for 1) Using SQL Server SELECT TOP with a constant value\">#<\/a><\/h3>\n\n\n\n<p>The following query uses <code>SELECT TOP<\/code> with a constant to return the top 10 most expensive products from the <code>production.products<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> TOP <span class=\"hljs-number\">10<\/span>\n    product_name, \n    list_price\n<span class=\"hljs-keyword\">FROM<\/span>\n    production.products\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \n    list_price <span class=\"hljs-keyword\">DESC<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Here is the result:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"292\" height=\"208\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-SELECT-TOP-top-ten-most-expensive-products.png\" alt=\"SQL Server SELECT TOP - top ten most expensive products\" class=\"wp-image-733\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id='2-using-select-top-to-return-a-percentage-of-rows'>2) Using SELECT TOP to return a percentage of rows <a href=\"#2-using-select-top-to-return-a-percentage-of-rows\" class=\"anchor\" id=\"2-using-select-top-to-return-a-percentage-of-rows\" title=\"Anchor for 2) Using SELECT TOP to return a percentage of rows\">#<\/a><\/h3>\n\n\n\n<p>The following example uses <code>PERCENT<\/code> to specify the number of products returned in the result set. <\/p>\n\n\n\n<p>The <code>production.products<\/code> table has <code>321<\/code> rows. Therefore, one percent of <code>321<\/code> is a fraction value ( <code>3.21<\/code>), SQL Server rounds it up to the next whole number, which is four ( <code>4<\/code>) in this case:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> TOP <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">PERCENT<\/span>\n    product_name, \n    list_price\n<span class=\"hljs-keyword\">FROM<\/span>\n    production.products\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \n    list_price <span class=\"hljs-keyword\">DESC<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"293\" height=\"98\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-SELECT-TOP-top-one-percent-most-expensive-products.png\" alt=\"SQL Server SELECT TOP - TOP PERCENT example\" class=\"wp-image-735\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id='3-using-select-top-with-ties-to-include-rows-that-match-values-in-the-last-row'>3) Using SELECT TOP WITH TIES to include rows that match values in the last row <a href=\"#3-using-select-top-with-ties-to-include-rows-that-match-values-in-the-last-row\" class=\"anchor\" id=\"3-using-select-top-with-ties-to-include-rows-that-match-values-in-the-last-row\" title=\"Anchor for 3) Using SELECT TOP WITH TIES to include rows that match values in the last row\">#<\/a><\/h3>\n\n\n\n<p>The following query uses the <code>SELECT TOP WITH TIES<\/code> to retrieve the top three most expensive products from the <code>production.products<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> TOP <span class=\"hljs-number\">3<\/span> <span class=\"hljs-keyword\">WITH<\/span> <span class=\"hljs-keyword\">TIES<\/span>\n    product_name, \n    list_price\n<span class=\"hljs-keyword\">FROM<\/span>\n    production.products\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \n    list_price <span class=\"hljs-keyword\">DESC<\/span>;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"176\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-SELECT-TOP-TOP-WITH-TIES-examples.png\" alt=\"SQL Server SELECT TOP - TOP WITH TIES example\" class=\"wp-image-734\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-SELECT-TOP-TOP-WITH-TIES-examples.png 569w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-SELECT-TOP-TOP-WITH-TIES-examples-300x93.png 300w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/figure>\n\n\n\n<p>In this example, the third most expensive product has a list price of <code>6499.99<\/code>. <\/p>\n\n\n\n<p>Because the statement uses <code>TOP WITH TIES<\/code>, it returns three additional products with the same list prices as the third one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the SQL Server <code>SELECT TOP<\/code> statement to limit the number of rows or percentage of rows returned by a query.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"731\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/\"\n\t\t\t\tdata-post-title=\"SQL Server SELECT TOP\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"731\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/\"\n\t\t\t\tdata-post-title=\"SQL Server SELECT TOP\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":100,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-731","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL Server SELECT TOP<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server SELECT TOP\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Server Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-24T13:59:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/products.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/\",\"name\":\"SQL Server SELECT TOP\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/products.png\",\"datePublished\":\"2018-07-31T08:23:32+00:00\",\"dateModified\":\"2024-09-24T13:59:37+00:00\",\"description\":\"This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/products.png\",\"contentUrl\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/products.png\",\"width\":206,\"height\":169,\"caption\":\"products\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/sql-server-select-top\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server Basics\",\"item\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-basics\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQL Server SELECT TOP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/#website\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/\",\"name\":\"SQL Server Tutorial\",\"description\":\"The Practical SQL Server Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server SELECT TOP","description":"This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server SELECT TOP","og_description":"This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.","og_url":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/","og_site_name":"SQL Server Tutorial","article_modified_time":"2024-09-24T13:59:37+00:00","og_image":[{"url":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/products.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/","url":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/","name":"SQL Server SELECT TOP","isPartOf":{"@id":"https:\/\/www.sqlservertutorial.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/products.png","datePublished":"2018-07-31T08:23:32+00:00","dateModified":"2024-09-24T13:59:37+00:00","description":"This tutorial shows you how to use the SQL Server SELECT TOP statement to limit the number of rows or percentage of rows returned by a query.","breadcrumb":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/#primaryimage","url":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/products.png","contentUrl":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/products.png","width":206,"height":169,"caption":"products"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-select-top\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlservertutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQL Server Basics","item":"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/"},{"@type":"ListItem","position":3,"name":"SQL Server SELECT TOP"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlservertutorial.net\/#website","url":"https:\/\/www.sqlservertutorial.net\/","name":"SQL Server Tutorial","description":"The Practical SQL Server Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlservertutorial.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/comments?post=731"}],"version-history":[{"count":3,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/731\/revisions"}],"predecessor-version":[{"id":4574,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/731\/revisions\/4574"}],"up":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/100"}],"wp:attachment":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/media?parent=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}