There is a table with 4 rows. Write a single SELECT statement which would return 16 rows. Use of temp table, CTE, Union all, and JOIN is not allowed
Loading
There is a table with 4 rows. Write a single SELECT statement which would return 16 rows. Use of temp table, CTE, Union all, and JOIN is not allowed
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Mar 2, 2023, 5:28 PM
select * from tableName t1, tableName t2
. Idk might be cross join he was talking about as we don't need to use join keyword for cross join.
but this question doesn't make sense.
Tuhin PaulPosted Mar 2, 2023, 6:45 PM
One way to achieve this is by using CROSS JOIN with the table itself:
This will return a total of 16 rows (4 x 4), with each row joined with every other row in the table.
Rajeev KumarPosted Mar 2, 2023, 1:29 PM
@Rijwan Ansari someone ask a quetion to me. I was also surprised to listen this question also.
Rijwan AnsariPosted Mar 2, 2023, 12:54 PM
Hi,
I am not sure about your question, however, if you have 4 rows in a table, why/how can you need to return 16 rows?