{"id":26187,"date":"2023-05-25T05:22:00","date_gmt":"2023-05-25T03:22:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=26187"},"modified":"2023-07-28T17:10:05","modified_gmt":"2023-07-28T15:10:05","slug":"sql-server-join-operator","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/","title":{"rendered":"SQL Server queries using the JOIN Operator"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-center\" id=\"h-example-of-queries-using-the-join-operator-written-in-t-sql-language-the-goal-is-to-join-data-from-multiple-tables\"><em>Example of queries using the JOIN operator written in T-SQL language, the goal is to join data from multiple tables.<\/em><\/h4>\n\n\n\n<p>In T-SQL, the Microsoft&#8217;s SQL Server programming language, a Join query between two or more tables is done using the JOIN keyword operator. This connection is made according to conditions specified in the WHERE clause. There are several variants of the JOIN operator, each with its own characteristics and uses.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-1-create-the-sample-tables-for-customers-and-orders-with-ssms\">1. Create the sample tables for customers and orders with SSMS<\/h2>\n\n\n\n<p>Here&#8217;s how to create two example tables used in the following JOIN queries.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-create-the-customers-table\"><em>Create the Customers table<\/em><\/h3>\n\n\n\n<p>Run this code in SSMS for example to create the customers table and insert rows into it.<\/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=\"\">-- Create the customers table\nCREATE TABLE customers (\nid INT PRIMARY KEY,\nname VARCHAR(255),\ncity VARCHAR(255)\n);\n\n-- Insert rows into the customers table\nINSERT INTO customers\n(id, name, city)\nVALUES\n(1, 'Dupont', 'Paris'),\n(2, 'Durand', 'Lyon'),\n(3, 'Martin', 'Marseille');\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-create-the-orders-table\"><em>Create the Orders table<\/em><\/h3>\n\n\n\n<p>Next, create the orders table with the T-SQL code below.<\/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=\"\">-- Create the orders table\nCREATE TABLE orders (\nid INT PRIMARY KEY,\ncustomer_id INT,\namount DECIMAL(10, 2),\norder_date DATE\n);\n\n-- Insert rows into the orders table\nINSERT INTO orders\n(id, customer_id, amount, order_date)\nVALUES\n(1, 1, 100.00, '2022-01-01'),\n(2, 2, 50.00, '2022-01-02'),\n(3, 1, 200.00, '2022-01-03'),\n(4, 3, 75.00, '2022-01-04');\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-sql-server-join-of-type-inner-join\">2. SQL Server Join of type INNER JOIN<\/h2>\n\n\n\n<p>The INNER JOIN operator allows linking rows from two tables, returning only the rows that have a match in both tables. A join condition is often used in the ON clause to specify how the rows are linked.<\/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 *\nFROM customers c\nINNER JOIN orders o\nON c.id = o.customer_id;<\/pre>\n\n\n\n<p>The result of the query with the INNER JOIN operator will therefore include 4 rows, like this:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>id<\/th><th>name<\/th><th>city<\/th><th>id<\/th><th>customer_id<\/th><th>amount<\/th><th>order_date<\/th><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-t-sql-left-join-operator\">3. T-SQL LEFT JOIN Operator<\/h2>\n\n\n\n<p>The LEFT JOIN operator allows linking rows from two tables, returning all rows from the left table and the matches in the right table if they exist. If a row in the left table does not have a match in the right table, a NULL row will be created in the result for this row.<\/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 *\nFROM customers c\nLEFT JOIN orders o\nON c.id = o.customer_id;\n<\/pre>\n\n\n\n<p>The result of this SQL LEFT JOIN query written in T-SQL.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>id<\/th><th>name<\/th><th>city<\/th><th>id<\/th><th>customer_id<\/th><th>amount<\/th><th>order_date<\/th><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><tr><td>4<\/td><td>Dupuis<\/td><td>Bordeaux<\/td><td>NULL<\/td><td>NULL<\/td><td>NULL<\/td><td>NULL<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-sql-server-right-join-operator\">4. SQL Server RIGHT JOIN Operator<\/h2>\n\n\n\n<p>The RIGHT JOIN operator is similar to the LEFT JOIN, but it returns all rows from the right table, as well as the matches in the left table if they exist. If a row in the right table does not have a match in the left table, a NULL row will be created in the result for this row.<\/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 *\nFROM customers c\nRIGHT JOIN orders o\nON c.id = o.customer_id;\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>The result of the right join query above will give a result like this one, using our sample tables: <\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>id<\/th><th>name<\/th><th>city<\/th><th>id<\/th><th>customer_id<\/th><th>amount<\/th><th>order_date<\/th><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><tr><td>NULL<\/td><td>NULL<\/td><td>NULL<\/td><td>5<\/td><td>2<\/td><td>25.00<\/td><td>2022-01-05<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You may also be interested in the SQL Server data type and their management.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"eT9YaSvFLn\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-data-types\/\">SQL Server data types with code examples to create columns<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;SQL Server data types with code examples to create columns&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-data-types\/embed\/#?secret=kbOxkIfqSC#?secret=eT9YaSvFLn\" data-secret=\"eT9YaSvFLn\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-5-sql-server-cross-join-join\">5. SQL Server CROSS JOIN Join<\/h2>\n\n\n\n<p>The T-SQL CROSS JOIN operator allows you to link all rows from the left table with all rows from the right table, without using a join condition.<\/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 *\nFROM customers c\nCROSS JOIN orders o;\n<\/pre>\n\n\n\n<p>The result of this CROSS JOIN type query, executed on the example tables, will be as follows.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>id<\/th><th>name<\/th><th>city<\/th><th>id<\/th><th>customer_id<\/th><th>amount<\/th><th>order_date<\/th><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>It&#8217;s important to note that the CROSS JOIN operator can quickly generate a very large number of rows in the result if the involved tables are large. It is therefore recommended to only use it when really necessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-6-the-t-sql-full-outer-join-query\">6. The T-SQL FULL OUTER JOIN query<\/h2>\n\n\n\n<p>The FULL OUTER JOIN operator allows linking the rows of two tables by returning all the rows from the left table, all the rows from the right table, and the matches between the two tables if they exist. If a row from one table has no match in the other table, a NULL row will be created in the result for that row.<\/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 *\nFROM clients c\nFULL OUTER JOIN orders o\nON c.id = o.client_id;\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>The result of the T-SQL query with FULL OUTER JOIN will be as follows.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>id<\/th><th>name<\/th><th>city<\/th><th>id<\/th><th>customer_id<\/th><th>amount<\/th><th>order_date<\/th><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>1<\/td><td>1<\/td><td>100.00<\/td><td>2022-01-01<\/td><\/tr><tr><td>2<\/td><td>Durand<\/td><td>Lyon<\/td><td>2<\/td><td>2<\/td><td>50.00<\/td><td>2022-01-02<\/td><\/tr><tr><td>1<\/td><td>Dupont<\/td><td>Paris<\/td><td>3<\/td><td>1<\/td><td>200.00<\/td><td>2022-01-03<\/td><\/tr><tr><td>3<\/td><td>Martin<\/td><td>Marseille<\/td><td>4<\/td><td>3<\/td><td>75.00<\/td><td>2022-01-04<\/td><\/tr><tr><td>4<\/td><td>Dupuis<\/td><td>Bordeaux<\/td><td>NULL<\/td><td>NULL<\/td><td>NULL<\/td><td>NULL<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-7-sql-server-query-with-self-join-or-auto-join\">7. SQL Server query with SELF JOIN or Auto-Join<\/h2>\n\n\n\n<p>The SELF JOIN operator allows linking the rows of the same table using two different aliases for the table. A join condition can be used in the ON clause to specify how the rows are linked. This query is also called an auto-join.<\/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 c1.name, c2.name\nFROM   clients c1\nJOIN  clients c2\n   ON c1.town = c2.town\nWHERE c1.name != c2.name;\n<\/pre>\n\n\n\n<p>The result of this query with the auto-join will be like this.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><th>name<\/th><th>name<\/th><\/tr><tr><td>Dupont<\/td><td>Martin<\/td><\/tr><tr><td>Martin<\/td><td>Dupont<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>It is important to note that these query examples with the SQL Server JOIN operator are just an introduction to the operators in T-SQL. It is also possible to perform joins with Integration Services, particularly with the SSIS Merge Join component.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-sql-server-join-operators\">Conclusion on SQL Server Join Operators<\/h3>\n\n\n\n<p>A SQL Server join with the T-SQL JOIN operator allows combining data from different tables into a single query. There are several types of JOIN operators, each with its own characteristics and uses. Here are some good practices and benefits to remember about using JOIN operators in T-SQL:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The INNER JOIN operator is used to return rows that have a match in both tables. This operator is the most used and the most performant.<\/li>\n\n\n\n<li>Use the LEFT JOIN operator to return all the rows from the left table, as well as all the matching rows from the right table. This operator is useful for including all the rows from the left table, even if they have no match in the right table.<\/li>\n\n\n\n<li>Use the RIGHT JOIN operator in a manner similar to the LEFT JOIN operator, but by reversing the order of the tables.<\/li>\n\n\n\n<li>And the FULL OUTER JOIN operator is useful to return all rows from both tables, whether or not they have a match. This operator is less performant than the other JOIN operators and is generally not recommended in common queries.<\/li>\n\n\n\n<li>Finally, use the CROSS JOIN operator to generate a Cartesian product of two tables. This operator can quickly generate a very large number of rows in the result, so it is recommended to only use it when really necessary.<\/li>\n<\/ul>\n\n\n\n<p>In summary, the JOIN operators in T-SQL allow combining data from several tables in an efficient and convenient way, which can be very useful in many situations. It&#8217;s important to <a href=\"https:\/\/academic.oup.com\/comjnl\/article\/64\/5\/789\/5827080\" target=\"_blank\" rel=\"noreferrer noopener\">choose the right type of JOIN<\/a> operator depending on your needs and your query, in order to get the desired result efficiently. Here is another more <a href=\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-left-joins-with-sql-server\/\">detailed tutorial on specific joins of the LEFT JOIN type<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"7SSxglljVq\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-left-joins-with-sql-server\/\">SQL Server left join examples<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;SQL Server left join examples&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-left-joins-with-sql-server\/embed\/#?secret=I02gU3RCR8#?secret=7SSxglljVq\" data-secret=\"7SSxglljVq\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Example of queries using the JOIN operator written in T-SQL language, the goal is to join data from multiple tables. In T-SQL, the Microsoft&#8217;s SQL Server programming language, a Join query between two or more tables is done using <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\" title=\"SQL Server queries using the JOIN Operator\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10314,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-26187","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"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 queries using the JOIN Operator - T-SQL<\/title>\n<meta name=\"description\" content=\"The SQL Server JOIN operator is widely used in T-SQL to perform a join to link the rows of two or more tables according to given conditions.\" \/>\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\/t-sql\/sql-server-join-operator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server queries using the JOIN Operator\" \/>\n<meta property=\"og:description\" content=\"The SQL Server JOIN operator is widely used in T-SQL to perform a join to link the rows of two or more tables according to given conditions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\" \/>\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-25T03:22:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-28T15:10:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"SQL Server queries using the JOIN Operator\",\"datePublished\":\"2023-05-25T03:22:00+00:00\",\"dateModified\":\"2023-07-28T15:10:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\"},\"wordCount\":1128,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\",\"name\":\"SQL Server queries using the JOIN Operator - T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg\",\"datePublished\":\"2023-05-25T03:22:00+00:00\",\"dateModified\":\"2023-07-28T15:10:05+00:00\",\"description\":\"The SQL Server JOIN operator is widely used in T-SQL to perform a join to link the rows of two or more tables according to given conditions.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server queries using the JOIN Operator\"}]},{\"@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 queries using the JOIN Operator - T-SQL","description":"The SQL Server JOIN operator is widely used in T-SQL to perform a join to link the rows of two or more tables according to given conditions.","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\/t-sql\/sql-server-join-operator\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server queries using the JOIN Operator","og_description":"The SQL Server JOIN operator is widely used in T-SQL to perform a join to link the rows of two or more tables according to given conditions.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-05-25T03:22:00+00:00","article_modified_time":"2023-07-28T15:10:05+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"SQL Server queries using the JOIN Operator","datePublished":"2023-05-25T03:22:00+00:00","dateModified":"2023-07-28T15:10:05+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/"},"wordCount":1128,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/","url":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/","name":"SQL Server queries using the JOIN Operator - T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg","datePublished":"2023-05-25T03:22:00+00:00","dateModified":"2023-07-28T15:10:05+00:00","description":"The SQL Server JOIN operator is widely used in T-SQL to perform a join to link the rows of two or more tables according to given conditions.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/blackboard-573023_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-join-operator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"SQL Server queries using the JOIN Operator"}]},{"@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\/26187","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=26187"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/26187\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10314"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=26187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=26187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=26187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}