Skip to main contentSkip to solution

Assume that the four digit area code is reflected in the mobile number starting from position number 3. For example, 2630 is the area code of mobile number 4726309212. Based on this, arrange the following SQL query to display the area code of the customer living in 'Rohini'.

(A) FROM CUSTOMER

(B) like '%Rohini%'

(C) WHERE CustAdd

(D) SELECT MID(Phone,3,4)

Solution

✅ Correct Option: 4

The query must follow the order SELECT, FROM, WHERE, condition. MID(Phone,3,4) extracts 4 characters starting at position 3, which gives the area code (for 4726309212 it returns 2630).

(D) SELECT MID(Phone,3,4)

(A) FROM CUSTOMER

(C) WHERE CustAdd

(B) like '%Rohini%'


Options 1, 2 and 3: each places WHERE or the LIKE condition out of order. The LIKE pattern (B) must come right after the column name in (C), and FROM must come before WHERE.

Keyboard Shortcuts

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