Skip to main contentSkip to solution

Given the following table:

Students

IDNameMarks
1.Alice85
2.Bob90
3.Charlie75

Which query will return all students having 'li' substring in their Names?

Solution

✅ Correct Option: 2

The LIKE operator matches patterns, and % stands for any number of characters (including none). The pattern '%li%' matches any name that contains "li" anywhere, so it returns both Alice and Charlie.


Option 1: = checks for an exact match, so only a name that is exactly "li" would match.

Option 3: '%li' matches only names that end with "li". Alice ends in "ce" and Charlie in "ie", so neither matches.

Option 4: 'li' has no wildcard, so it behaves like an exact match.

'li%' matches names that start with "li", and '%li' matches names that end with "li".

Keyboard Shortcuts

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