Which of the following SQL keywords is used to display data from a table based…
2023
Which of the following SQL keywords is used to display data from a table based on certain pattern?
- A.
IN
- B.
LIKE
- C.
BETWEEN
- D.
More than one of the above
- E.
None of the above
Attempted by 1589 students.
Show answer & explanation
Correct answer: B
To display data from a table based on a certain pattern, the SQL keyword LIKE is used. It allows pattern matching using wildcards such as % (matches zero or more characters) and _ (matches exactly one character). The IN keyword is used to check if a value matches any value in a specified list, not for pattern matching. For example, IN ('A', 'B') checks for exact matches. The BETWEEN keyword is used to filter values within a specified range, such as BETWEEN 10 AND 20. It is not used for text pattern matching. Therefore, only the LIKE keyword supports pattern-based data retrieval, making it the correct choice.