Use of Cartesian Product in SQL
What is Cartesian Product in SQL ?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Oct 29, 2012, 8:34 PM EDT
Suppose we have 2 row in firts table and 3 row in second table then 2*3 =6 rows will be display
Like
SELECT * FROM COURSE
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 29, 2012, 11:01 PM EDT
The Cartesian product returns a number of rows equal to the product of all rows in all the tables being joined.
example
if the first table has 10 rows and the second table has 5 rows, the result will be 10 * 5 = 50 rows.
it also known as cross join
Please refer
http://msdn.microsoft.com/en-us/library/ms190690%28v=sql.105%29.aspx
Rajeev KumarRank #1,334 · 1.3K reputationPosted Feb 27, 2023, 12:52 AM EST
Cartesian product returns a number of rows from 1st * 2nd Table.
if the first table has 20 rows and the second table has 3 rows, then result will be 20 * 3 = 60 rows. Cartesian Product is also well known as Cross Join. We write a syntax as below--
SELECT * FROM Tbllecture
CROSS JOIN Tblteacher