+ 1
How many outputs will I get if I select all from two different tables?
I encountered a question in the SQL intermediate course that doesn't make sense to me... SELECT * FROM table1, table2 Question: table 1 has 3 rows, table 2 has 5 rows, how many rows will be returned in the output? The answer seems to be 15 rows... but I don't understand why? Is this an example of JOIN, and what kind of join is this?
6 Answers
+ 7
Yuen Chee Tong
I think answer is given in comment section by different users.
This is called CROSS JOIN which returns all the combination of the table so answer is 3 * 5 = 15
+ 3
Sakshi his question is related to the logic behind the synthax of SQL. I think he already provided the details.
He asks why the given synthax produces 15 as the output
+ 3
Sakshi
That is quiz question which is already mentioned in this question.
+ 3
A͢J Ok sir, sorry for the inconvenience from my side.
+ 1
Share your attempt
0
Muhd Khairul Amirin I think the code could still have been shared if attempted in the description.