+ 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?

21st Jul 2023, 1:15 PM
Yuen Chee Tong
Yuen Chee Tong - avatar
6 Respuestas
+ 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
21st Jul 2023, 2:31 PM
A͢J
A͢J - avatar
+ 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
21st Jul 2023, 2:28 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 3
Sakshi That is quiz question which is already mentioned in this question.
21st Jul 2023, 3:31 PM
A͢J
A͢J - avatar
+ 3
A͢J Ok sir, sorry for the inconvenience from my side.
21st Jul 2023, 4:24 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 1
Share your attempt
21st Jul 2023, 1:32 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
0
Muhd Khairul Amirin I think the code could still have been shared if attempted in the description.
21st Jul 2023, 3:08 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar