{"id":794,"date":"2016-07-08T03:05:38","date_gmt":"2016-07-08T03:05:38","guid":{"rendered":"https:\/\/sqltutorial.org\/?page_id=794"},"modified":"2025-02-09T18:41:18","modified_gmt":"2025-02-10T01:41:18","slug":"sql-cross-join","status":"publish","type":"page","link":"https:\/\/www.sqltutorial.org\/sql-cross-join\/","title":{"rendered":"SQL CROSS JOIN"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the SQL <code>CROSS JOIN<\/code> clause to combine every row from the first table with every row in the second table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-sql-cross-join-clause'>Introduction to SQL CROSS JOIN clause <a href=\"#introduction-to-sql-cross-join-clause\" class=\"anchor\" id=\"introduction-to-sql-cross-join-clause\" title=\"Anchor for Introduction to SQL CROSS JOIN clause\">#<\/a><\/h2>\n\n\n\n<p>The <code>CROSS JOIN<\/code> clause is an optional clause of the <code><a href=\"https:\/\/www.sqltutorial.org\/sql-select\/\">SELECT<\/a><\/code> statement. The <code>CROSS JOIN<\/code> clause allows you to create combinations of all rows from two tables.<\/p>\n\n\n\n<p>Here&#8217;s the syntax of the <code>CROSS JOIN<\/code> clause:<\/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>\n  select_list\n<span class=\"hljs-keyword\">FROM<\/span>\n  table1\n  <span class=\"hljs-keyword\">CROSS<\/span> <span class=\"hljs-keyword\">JOIN<\/span> table2;<\/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:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, provide the first table in the <code>FROM<\/code> clause.<\/li>\n\n\n\n<li>Second, specify the second table you want to merge the rows of the first table in the <code>CROSS JOIN<\/code> clause.<\/li>\n<\/ul>\n\n\n\n<p>Unlike a <a href=\"https:\/\/www.sqltutorial.org\/sql-left-join\/\">left join<\/a>, right join, <a href=\"https:\/\/www.sqltutorial.org\/sql-inner-join\/\">inner join<\/a>, and <a href=\"https:\/\/www.sqltutorial.org\/sql-full-outer-join\/\">full join<\/a>, the <a href=\"https:\/\/www.sqltutorial.org\/sql-cross-join\/\">cross join<\/a> does not have a condition.<\/p>\n\n\n\n<p>The <code>CROSS JOIN<\/code> clause merges every row from the first table (<code>table1<\/code>) with every row in the second table (<code>table2<\/code>). It returns a result set that includes all possible combinations of the rows in both tables.<\/p>\n\n\n\n<p class=\"note\">The result set of a <code>CROSS JOIN<\/code> is often called the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cartesian_product\" target=\"_blank\" rel=\"noreferrer noopener\">Cartesian product<\/a> of two tables.<\/p>\n\n\n\n<p>If the <code>table1<\/code> has <code>n<\/code> rows and <code>table2<\/code> has <code>m<\/code> rows, the <code>CROSS JOIN<\/code> will return a result set that includes <code>n * m<\/code> rows.<\/p>\n\n\n\n<p>For example, if the <code>table1<\/code> has two rows and <code>table2<\/code> has three rows, the result of the cross-join of the two tables will have <code>6<\/code> rows (<code>2 * 3<\/code>).<\/p>\n\n\n\n<p>Alternatively, you can perform a cross-join by listing the tables in the <code>FROM<\/code> clause of the <code>SELECT<\/code> statement as follows:<\/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>\n  select_list\n<span class=\"hljs-keyword\">FROM<\/span>\n  table1,\n  table2;<\/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<h2 class=\"wp-block-heading\" id='understanding-the-cross-join'>Understanding the cross join <a href=\"#understanding-the-cross-join\" class=\"anchor\" id=\"understanding-the-cross-join\" title=\"Anchor for Understanding the cross join\">#<\/a><\/h2>\n\n\n\n<p id=\"block-973a91d0-8e1f-4bc3-9f01-c5e188962280\">Suppose you have two tables:<\/p>\n\n\n\n<ul id=\"block-1e3e94a1-323e-470b-a6d5-45d84dba0705\" class=\"wp-block-list\">\n<li>The <code>X<\/code> table has two columns <code>id <\/code>(key) and <code>x<\/code>.<\/li>\n\n\n\n<li>The <code>Y<\/code> table also has two columns <code>id<\/code> (key) and <code>y<\/code>.<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><img decoding=\"async\" src=\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg\" alt=\"\" class=\"wp-image-3532\"\/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"alignleft size-full\"><img decoding=\"async\" src=\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/y-table-cross-join-1.svg\" alt=\"y table - cross join\" class=\"wp-image-3531\"\/><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<p id=\"block-9b68ea9c-7eaa-4068-8a60-47d522b4824c\">The cross join\u00a0combines every row from the left table (<code>X<\/code>) and the right table (<code>Y<\/code>) to create the final result set:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/sql-cross-join-visualization.svg\" alt=\"sql cross join visualization\" class=\"wp-image-3528\"\/><\/figure>\n<\/div>\n\n\n<p>The following diagram is another way to illustrate a cross join:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/sql-cross-join-diagram.svg\" alt=\"sql cross join diagram\" class=\"wp-image-3536\"\/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id='sql-cross-join-clause-example'>SQL CROSS JOIN clause example <a href=\"#sql-cross-join-clause-example\" class=\"anchor\" id=\"sql-cross-join-clause-example\" title=\"Anchor for SQL CROSS JOIN clause example\">#<\/a><\/h2>\n\n\n\n<p>First, <a href=\"https:\/\/www.sqltutorial.org\/sql-create-table\/\">create a new table<\/a> called <code>trainings<\/code> to store the training programs:<\/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\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> trainings (\n  <span class=\"hljs-keyword\">id<\/span> <span class=\"hljs-built_in\">INT<\/span> PRIMARY <span class=\"hljs-keyword\">KEY<\/span>,\n  program_name <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">255<\/span>) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>,\n  <span class=\"hljs-keyword\">duration<\/span> <span class=\"hljs-built_in\">INT<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>\n);<\/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><a href=\"https:\/\/www.sqltutorial.org\/playground\/?q=Q1JFQVRFIFRBQkxFIHRyYWluaW5ncyAoIGlkIElOVCBQUklNQVJZIEtFWSwgcHJvZ3JhbV9uYW1lIFZBUkNIQVIoMjU1KSBOT1QgTlVMTCwgZHVyYXRpb24gSU5UIE5PVCBOVUxMICk7\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Second, <a href=\"https:\/\/www.sqltutorial.org\/sql-insert\/\">insert some rows<\/a> into the <code>trainings<\/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\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span>\n  trainings (<span class=\"hljs-keyword\">id<\/span>, program_name, <span class=\"hljs-keyword\">duration<\/span>)\n<span class=\"hljs-keyword\">VALUES<\/span>\n  (<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-string\">'Leadership Skills'<\/span>, <span class=\"hljs-number\">1<\/span>),\n  (<span class=\"hljs-number\">2<\/span>, <span class=\"hljs-string\">'Communication Skills'<\/span>, <span class=\"hljs-number\">2<\/span>);<\/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><a href=\"https:\/\/www.sqltutorial.org\/playground\/?q=SU5TRVJUIElOVE8gdHJhaW5pbmdzIChpZCwgcHJvZ3JhbV9uYW1lLCBkdXJhdGlvbikgVkFMVUVTICgxLCAnTGVhZGVyc2hpcCBTa2lsbHMnLCAxKSwgKDIsICdDb21tdW5pY2F0aW9uIFNraWxscycsIDIpOw%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Third, use a <code>CROSS JOIN<\/code> clause to generate all possible combinations of employees and training programs:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" 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>\n  first_name,\n  program_name\n<span class=\"hljs-keyword\">FROM<\/span>\n  employees\n  <span class=\"hljs-keyword\">CROSS<\/span> <span class=\"hljs-keyword\">JOIN<\/span> trainings\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  first_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><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><a href=\"https:\/\/www.sqltutorial.org\/playground\/?q=U0VMRUNUIGZpcnN0X25hbWUsIHByb2dyYW1fbmFtZSBGUk9NIGVtcGxveWVlcyBDUk9TUyBKT0lOIHRyYWluaW5ncyBPUkRFUiBCWSBmaXJzdF9uYW1lOw%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\"> first_name  |     program_name\n-------------+----------------------\n Adam        | Communication Skills\n Adam        | Leadership Skills\n Alexander   | Leadership Skills\n Alexander   | Communication Skills\n Alexander   | Communication Skills\n Alexander   | Leadership Skills\n Britney     | Communication Skills\n Britney     | Leadership Skills\n...<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following query performs the same <code>CROSS JOIN<\/code> clause as the example above but uses the alternative syntax:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" 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>\n  first_name,\n  program_name\n<span class=\"hljs-keyword\">FROM<\/span>\n  employees,\n  trainings\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  first_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><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><a href=\"https:\/\/www.sqltutorial.org\/playground\/?q=U0VMRUNUIGZpcnN0X25hbWUsIHByb2dyYW1fbmFtZSBGUk9NIGVtcGxveWVlcywgdHJhaW5pbmdzIE9SREVSIEJZIGZpcnN0X25hbWU7\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/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 <code>CROSS JOIN<\/code> clause to combine every row in the first table with every row from the second table.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='quiz'>Quiz <a href=\"#quiz\" class=\"anchor\" id=\"quiz\" title=\"Anchor for Quiz\">#<\/a><\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">iframe<\/span>\n  <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"quiz\"<\/span>\n  <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"\/quiz\/?quiz=cross-join\"<\/span>\n  <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">\"700\"<\/span>\n  <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">\"600\"<\/span>\n  <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"iframe\"<\/span>\n&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">iframe<\/span>&gt;<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='databases'>Databases <a href=\"#databases\" class=\"anchor\" id=\"databases\" title=\"Anchor for Databases\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-cross-join\/\" target=\"_blank\" rel=\"noreferrer noopener\">PostgreSQL CROSS JOIN<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-cross-join\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL CROSS JOIN<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-cross-join\/\" target=\"_blank\" rel=\"noreferrer noopener\">SQLite CROSS JOIN<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.db2tutorial.com\/db2-basics\/db2-cross-join\/\" target=\"_blank\" rel=\"noreferrer noopener\">Db2 CROSS JOIN<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-cross-join\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oracle CROSS JOIN<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-cross-join\/\" target=\"_blank\" rel=\"noreferrer noopener\">SQL Server CROSS JOIN<\/a><\/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=\"794\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqltutorial.org\/sql-cross-join\/\"\n\t\t\t\tdata-post-title=\"SQL CROSS JOIN\"\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=\"794\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqltutorial.org\/sql-cross-join\/\"\n\t\t\t\tdata-post-title=\"SQL CROSS JOIN\"\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>You&#8217;ll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":20,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-794","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL CROSS JOIN<\/title>\n<meta name=\"description\" content=\"You&#039;ll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.\" \/>\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.sqltutorial.org\/sql-cross-join\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL CROSS JOIN\" \/>\n<meta property=\"og:description\" content=\"You&#039;ll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqltutorial.org\/sql-cross-join\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-10T01:41:18+00:00\" \/>\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.sqltutorial.org\/sql-cross-join\/\",\"url\":\"https:\/\/www.sqltutorial.org\/sql-cross-join\/\",\"name\":\"SQL CROSS JOIN\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqltutorial.org\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.sqltutorial.org\/sql-cross-join\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.sqltutorial.org\/sql-cross-join\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg\",\"datePublished\":\"2016-07-08T03:05:38+00:00\",\"dateModified\":\"2025-02-10T01:41:18+00:00\",\"description\":\"You'll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqltutorial.org\/sql-cross-join\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqltutorial.org\/sql-cross-join\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqltutorial.org\/sql-cross-join\/#primaryimage\",\"url\":\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg\",\"contentUrl\":\"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqltutorial.org\/sql-cross-join\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqltutorial.org\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL CROSS JOIN\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqltutorial.org\/#website\",\"url\":\"https:\/\/www.sqltutorial.org\/\",\"name\":\"SQL Tutorial\",\"description\":\"An Interactive SQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqltutorial.org\/?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 CROSS JOIN","description":"You'll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.","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.sqltutorial.org\/sql-cross-join\/","og_locale":"en_US","og_type":"article","og_title":"SQL CROSS JOIN","og_description":"You'll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.","og_url":"https:\/\/www.sqltutorial.org\/sql-cross-join\/","og_site_name":"SQL Tutorial","article_modified_time":"2025-02-10T01:41:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqltutorial.org\/sql-cross-join\/","url":"https:\/\/www.sqltutorial.org\/sql-cross-join\/","name":"SQL CROSS JOIN","isPartOf":{"@id":"https:\/\/www.sqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqltutorial.org\/sql-cross-join\/#primaryimage"},"image":{"@id":"https:\/\/www.sqltutorial.org\/sql-cross-join\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg","datePublished":"2016-07-08T03:05:38+00:00","dateModified":"2025-02-10T01:41:18+00:00","description":"You'll learn how to use the SQL CROSS JOIN clause to combine every row from the first table with every row in the second table.","breadcrumb":{"@id":"https:\/\/www.sqltutorial.org\/sql-cross-join\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqltutorial.org\/sql-cross-join\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqltutorial.org\/sql-cross-join\/#primaryimage","url":"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg","contentUrl":"https:\/\/www.sqltutorial.org\/wp-content\/uploads\/2025\/02\/x-table-cross-join.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqltutorial.org\/sql-cross-join\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"SQL CROSS JOIN"}]},{"@type":"WebSite","@id":"https:\/\/www.sqltutorial.org\/#website","url":"https:\/\/www.sqltutorial.org\/","name":"SQL Tutorial","description":"An Interactive SQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/pages\/794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/comments?post=794"}],"version-history":[{"count":0,"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/pages\/794\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqltutorial.org\/wp-json\/wp\/v2\/media?parent=794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}