195k views
5 votes
We have two tables,

Table1 - 5 Columns, 10 Rows

Table2 - 2 Columns, 5 Rows

.

What will be the output of the following SQL query? SELECT * FROM Table1 CROSS JOIN Table2

O 7 Columns, 15 Rows

O 7 Columns, 50 Rows

O 10 Columns, 15 Rows

O 10 Columns, 50 Rows​

User Rama
by
4.4k points

1 Answer

2 votes

Answer:

7 Columns, 50 Rows

Step-by-step explanation:

Given

Table 1


Columns = 5


Rows = 10

Table 2


Columns = 2


Rows = 5

SQL join: Cross Join

Required

The number of rows and columns

In cross join, the number of rows that will be returned is calculated using:


Rows = Row_1 * Row_2

So, we have:


Rows = 10 * 5


Rows = 50

Since all columns in both tables are selected, the new table will have the following number of columns


Columns = Column_1 + Column_2

So, we have:


Columns = 5 + 2


Columns = 7

User DDomen
by
4.0k points