Skip to main contentSkip to solution

Consider two tables 'EMP' and 'PARKING':

EMP(S.No, Name, Dept);

PARKING(S.No, Name, Dept);

Which of the following query will display only those rows such that the attribute "name" in both the tables have the same value?

Solution

✅ Correct Option: 4

Listing both tables in the FROM clause separated by a comma makes a cross join (every EMP row paired with every PARKING row). The WHERE clause then keeps only the pairs where E.Name=P.NameE.Name = P.Name, so only rows with matching names are shown. This is the standard syntax of an implicit join.


Options 1, 2 and 3: "FROM EMP E and PARKING P" is invalid, since tables are separated by a comma (or JOIN), never by "and".

Options 1 and 2: GROUP BY groups rows by a column or expression and does not filter rows.

Option 3: HAVING filters groups after GROUP BY, and it is not the right clause for a row-level join condition.

Keyboard Shortcuts

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