QuestionQ126

VerifiedRestricting and Sorting Data

You must display the first names of every customer in the customers table whose name contains the character 'e' and whose second-last character is 'a'.

Which query produces the required result?

Question Image

Explanation

In Oracle SQL, INSTR returns 0 when the searched substring is not present, so INSTR(cust_first_name, 'e') <> 0 requires an e in the name. A negative SUBSTR position counts backward from the end; therefore, SUBSTR(cust_first_name, -2, 1) returns the single second-to-last character, which can be tested for a.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!