Practice mode DBMS and SQL

Which LIKE pattern matches only strings that are exactly four characters long and end in ‘k’?

Correct answer C. '___k'

Explanation

In LIKE, each underscore matches exactly one character, while % matches any sequence of zero or more characters. Three underscores followed by k therefore match exactly four-character strings ending in k, such as 'desk' or 'book'. '%k' and '%%%k' match any length ending in k, because repeated % signs still mean any sequence. '_k%' requires k in the second position.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.