Given Table 'Uniform':
Ucode Uname Ucolor 1 Shirt White 2 Trouser Grey 3 Tie Blue
Given Table 'Cost':
Ucode Size Price 1 L 580 2 M 500 3 L 890 4 M 810
Find the output for: SELECT * FROM UNIFORM, COST;
Given Table 'Uniform':
| Ucode | Uname | Ucolor |
|---|---|---|
| 1 | Shirt | White |
| 2 | Trouser | Grey |
| 3 | Tie | Blue |
Given Table 'Cost':
| Ucode | Size | Price |
|---|---|---|
| 1 | L | 580 |
| 2 | M | 500 |
| 3 | L | 890 |
| 4 | M | 810 |
Find the output for: SELECT * FROM UNIFORM, COST;
Solution
SELECT * from two tables with no WHERE condition gives the Cartesian product. Every row of UNIFORM is paired with every row of COST, and all columns of both tables are shown, including both Ucode columns.
Each UNIFORM row (1, 2, 3) therefore appears next to each COST row, which is the pattern in Option 3.
Options 1 and 2: these show only matching Ucode rows, which needs a join condition such as WHERE Uniform.Ucode = Cost.Ucode. No condition is given here.
Option 4: SELECT * includes every column, so the first Ucode column cannot be dropped.
We believe the answer could be none of the options exactly, since COST has 4 rows, so the Cartesian product should have rows, including the row for Ucode 4 (M, 810), which Option 3 leaves out. However, NTA's final answer key (after all challenges) says Option 3.
Related questions:
2025: 14 May Shift 1
2025: 14 May Shift 1
2025: 3 June Shift 2
2025: 14 May Shift 1