Skip to main contentSkip to solution

Given Table 'Uniform':

UcodeUnameUcolor
1ShirtWhite
2TrouserGrey
3TieBlue

Given Table 'Cost':

UcodeSizePrice
1L580
2M500
3L890
4M810

Find the output for: SELECT * FROM UNIFORM, COST;

Solution

✅ Correct Option: 3

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 3×4=123 \times 4 = 12 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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question