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)
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
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.
Related questions:
2026: 29 May Shift 2
2026: 19 May Shift 1
2025: 13 May Shift 2
2025: 13 May Shift 2
2025: 20 May Shift 1
2025: 30 May Shift 2