Skip to main contentSkip to solution

Consider the following tables in the SchoolUniform database. :

Table 1: UNIFORM (UCode, UName, UColor)

Table 2: COST (UCode, Size, Price)

UCode is Primary Key in table 'UNIFORM' and serves as a Foreign Key in table 'COST'

Identify the correct query to display UCode, UName, UColor, Size, Price from both the tables (Display UCode column only once)

Solution

✅ Correct Option: 1

NATURAL JOIN joins the two tables on all columns with the same name, here UCode, and shows that common column only once. So SELECT * FROM UNIFORM NATURAL JOIN COST; gives UCode, UName, UColor, Size, Price, which is exactly what is asked.


Option 2: with no join condition this gives a Cartesian product, and Uniform.*, Cost.* shows UCode twice.

Option 3: no join condition, so every row of UNIFORM pairs with every row of COST, and UCode appears twice.

Option 4: invalid syntax, since ON cannot be used with a comma join and ON UCode is not a valid condition.

Keyboard Shortcuts

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