{"id":26225,"date":"2023-05-29T06:59:00","date_gmt":"2023-05-29T04:59:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=26225"},"modified":"2023-07-29T16:06:47","modified_gmt":"2023-07-29T14:06:47","slug":"sql-server-subqueries","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/","title":{"rendered":"SQL Server subqueries tutorial with examples"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"h-sql-server-subqueries-used-with-select-where-and-join-operators\"><strong><em>SQL Server subqueries used with SELECT, WHERE and JOIN operators.<\/em><\/strong><\/h4>\n\n\n\n<p>Transact-SQL (T-SQL) is a crucial extension of SQL used predominantly in Microsoft SQL Server environments, here we&#8217;ll learn how to write subqueries. This guide dives into T-SQL subqueries, a high-level concept that allows for nesting SQL queries within other queries. By exploring their role in SQL INSERT operations, SQL JOINS, and SQL GROUP BY clauses, we illustrate these concepts using a &#8216;Sales&#8217; database table.<\/p>\n\n\n\n<p>This tutorial aims to enrich your understanding of T-SQL subqueries, enabling you to write more efficient and flexible SQL code, and enhancing your data analysis and database management skills. Technically, a subquery is a SQL query nested inside a larger query. A subquery may occur in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A SELECT clause<\/li>\n\n\n\n<li>A FROM clause<\/li>\n\n\n\n<li>A WHERE clause<\/li>\n\n\n\n<li>A JOIN operation<\/li>\n<\/ul>\n\n\n\n<p>The subquery can be nested inside a SELECT, INSERT, UPDATE, DELETE, or another subquery. A subquery can return a set of rows or just a single row. Here we are going to explore subqueries in T-SQL using the <code>Sales<\/code> table created above.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-prerequisite-create-the-sample-table-used-in-the-examples\"><em>Prerequisite : Create the sample table used in the examples<\/em><\/h3>\n\n\n\n<p>Use the <a href=\"https:\/\/expert-only.com\/en\/ssis\/ssis-merge-join\/#1-prepare-the-source-and-target-tables-to-join-with-ssms\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Sales table creation script available in this tutorial<\/strong><\/a> to create a table in SSMS and reproduce the queries.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-1-subqueries-in-insert-statements\">1. Subqueries in INSERT statements<\/h2>\n\n\n\n<p>Subqueries can be used in the <code>INSERT<\/code> statement to insert data into a table from one or more other tables. First example: If we had another table named <code><strong>DiscountedSales<\/strong><\/code>, and we wanted to add all sales from 2022 where the quantity was above 5 from the <strong><code>Sales<\/code> <\/strong>table, <a href=\"https:\/\/www.dictionary.com\/browse\/query\" target=\"_blank\" rel=\"noreferrer noopener\">the query<\/a> would look something like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">INSERT INTO DiscountedSales\nSELECT *\nFROM   Sales\nWHERE  YearID = '2022'\n   AND Qty > 5;\n<\/pre>\n\n\n\n<p>This subquery is pulling the relevant data from the <code>Sales<\/code> table and inserting it into the <code>DiscountedSales<\/code> table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-subqueries-in-joins-queries\">2. Subqueries in JOINS queries<\/h2>\n\n\n\n<p>In SQL Server and in generic SQL, you can join a table to the result set of a subquery, like in this second example. Suppose we want to join <code>Sales<\/code> with a subquery that returns the maximum sales for each customer.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT S1.CustomerID, S1.Sales, S2.MaxSales\nFROM Sales S1\nJOIN (\n    SELECT CustomerID, MAX(Sales) as MaxSales\n    FROM Sales\n    GROUP BY CustomerID\n) S2 ON S1.CustomerID = S2.CustomerID;\n<\/pre>\n\n\n\n<p>This subquery joins the <code>Sales<\/code> table to a derived table <code>S2<\/code> that contains the maximum sales for each customer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-subqueries-in-group-by\">3. Subqueries in GROUP BY<\/h2>\n\n\n\n<p>A subquery can also be used in a <a href=\"https:\/\/expert-only.com\/en\/t-sql\/group-by-query-examples-in-t-sql\/\">SQL Server GROUP BY clause<\/a>. Let&#8217;s calculate the total sales for each customer, but only include customers that have made sales in 2022.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CustomerID, SUM(Sales)\nFROM Sales\nWHERE CustomerID IN (\n    SELECT DISTINCT CustomerID\n    FROM Sales\n    WHERE YearID = '2022'\n)\nGROUP BY CustomerID;\n<\/pre>\n\n\n\n<p>The subquery here selects distinct <code>CustomerID<\/code>s where <code>YearID<\/code> is &#8216;2022&#8217;, and then the outer query calculates the total sales for these customers.<\/p>\n\n\n\n<p>Here&#8217;s what your result will look like, if you use the sample table provided in the beginning of the tutorial:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>CustomerID<\/th><th>SUM(Sales)<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>21238.40<\/td><\/tr><tr><td>2<\/td><td>13937.00<\/td><\/tr><tr><td>3<\/td><td>2306.40<\/td><\/tr><tr><td>4<\/td><td>9079.30<\/td><\/tr><tr><td>5<\/td><td>20046.70<\/td><\/tr><tr><td>6<\/td><td>9674.50<\/td><\/tr><tr><td>7<\/td><td>14100.80<\/td><\/tr><tr><td>8<\/td><td>5715.50<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-sql-server-scalar-subqueries\">4. SQL Server Scalar Subqueries<\/h2>\n\n\n\n<p>A scalar subquery is a subquery that returns exactly one column value from one row. Let&#8217;s find the average sales of the best-selling product with this 4th example to illustrate the scalar T-SQL subqueries.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT AVG(Sales)\nFROM Sales\nWHERE ProductID = (\n    SELECT TOP 1 ProductID\n    FROM Sales\n    GROUP BY ProductID\n    ORDER BY SUM(Qty) DESC\n);\n<\/pre>\n\n\n\n<p>The subquery identifies the <code>ProductID<\/code> of the best-selling product by quantity, and then the outer query calculates the average sales of this product.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-5-correlated-subqueries\">5. Correlated Subqueries<\/h2>\n\n\n\n<p>A correlated SQL Server subquery works like a nested loop: the subquery only has access to rows related to a single record at a time in the outer query. The subquery can refer to a column from a table listed in the FROM list of the outer query. Let&#8217;s find the customers who have sales above the average sales of all customers.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT DISTINCT S1.CustomerID \nFROM Sales S1\nWHERE S1.Sales > (\n    SELECT AVG(S2.Sales)\n    FROM Sales S2\n    WHERE S1.CustomerID = S2.CustomerID\n);\n<\/pre>\n\n\n\n<p>The correlated subquery <strong>calculates the average sales for each customer one at a time<\/strong>, and then the outer query compares these average sales to each individual sales transaction.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-sql-server-subqueries\">Conclusion on SQL Server subqueries<\/h3>\n\n\n\n<p>Subqueries in SQL provide powerful ways to perform complex calculations, filter data, and even transform data. You can use them in various places in your SQL statements to solve tricky data problems. Remember that while subqueries can be very useful, they can also be very slow, especially for large data sets. Always test your queries to ensure they perform as expected.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>SQL Server subqueries used with SELECT, WHERE and JOIN operators. Transact-SQL (T-SQL) is a crucial extension of SQL used predominantly in Microsoft SQL Server environments, here we&#8217;ll learn how to write subqueries. This guide dives into T-SQL subqueries, a <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\" title=\"SQL Server subqueries tutorial with examples\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10654,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-26225","post","type-post","status-publish","format-standard","has-post-thumbnail"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Server subqueries tutorial with examples -<\/title>\n<meta name=\"description\" content=\"SQL Server subqueries tutorial with examples, a high-level concept that allows for nesting queries within other queries.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server subqueries tutorial with examples\" \/>\n<meta property=\"og:description\" content=\"SQL Server subqueries tutorial with examples, a high-level concept that allows for nesting queries within other queries.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-29T04:59:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-29T14:06:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"SQL Server subqueries tutorial with examples\",\"datePublished\":\"2023-05-29T04:59:00+00:00\",\"dateModified\":\"2023-07-29T14:06:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\"},\"wordCount\":639,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\",\"url\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\",\"name\":\"SQL Server subqueries tutorial with examples -\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg\",\"datePublished\":\"2023-05-29T04:59:00+00:00\",\"dateModified\":\"2023-07-29T14:06:47+00:00\",\"description\":\"SQL Server subqueries tutorial with examples, a high-level concept that allows for nesting queries within other queries.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server subqueries tutorial with examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server subqueries tutorial with examples -","description":"SQL Server subqueries tutorial with examples, a high-level concept that allows for nesting queries within other queries.","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:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server subqueries tutorial with examples","og_description":"SQL Server subqueries tutorial with examples, a high-level concept that allows for nesting queries within other queries.","og_url":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-05-29T04:59:00+00:00","article_modified_time":"2023-07-29T14:06:47+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"SQL Server subqueries tutorial with examples","datePublished":"2023-05-29T04:59:00+00:00","dateModified":"2023-07-29T14:06:47+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/"},"wordCount":639,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/","url":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/","name":"SQL Server subqueries tutorial with examples -","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg","datePublished":"2023-05-29T04:59:00+00:00","dateModified":"2023-07-29T14:06:47+00:00","description":"SQL Server subqueries tutorial with examples, a high-level concept that allows for nesting queries within other queries.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/fresh-glass-coffee-cup-2D256C64A99_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"SQL Server subqueries tutorial with examples"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/26225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=26225"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/26225\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10654"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=26225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=26225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=26225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}