Examine the description of the CUSTOMERS table:
You want to display details of all customers who reside in cities starting with the letter D followed by at least two characters.
Which query can be used?
Examine the description of the CUSTOMERS table:
You want to display details of all customers who reside in cities starting with the letter D followed by at least two characters.
Which query can be used?
The correct query should use the LIKE clause to find cities that start with 'D' followed by at least two characters. The underscore (_) in SQL represents any single character, and the percent sign (%) represents zero or more characters. Therefore, the correct pattern to match cities starting with 'D' followed by at least two characters is 'D__%'. However, among the provided options, option A ('SELECT * FROM customers WHERE city LIKE 'D_%';') is the closest one, as it uses the LIKE clause and the correct syntax, even though it doesn't strictly enforce the condition of having at least two characters following 'D'. The other options either misuse the LIKE clause or the equality operator, or don't match the described criteria at all.
there is no valid answer here correct would be (followed by at least two characters): SELECT * FROM EMPLOYEES WHERE FIRST_NAME LIKE 'D__%'; but A is the most correct
You're right. Also, there's no valid answer because double quotes are used in the LIKE clause
I assume there's been some issue with copy-pasting the text, and the first ' as been replaced with "~ I think it's supposed to be A anyway, but you're certainly correct that they're all wrong written as they are.
yes, A is the correct answer
Many comments here saying that 2 underscores must be there but I think single underscore is enough because 'D_%' means that after underscore % means that there must be a character or more to display the result. Hence, A option is accurate and correct.
A is the most close to be valid answer. LIKE must be used when comparing text strings (B, D are incorrect), metacharacter % must be used to accept strings of variable length (C is incorrect), metacharacter _ stands for any character. Underscore _ should be doubled to fulfill the request of two additional characters that follows initial letter D, so the query should end with LIKE ‘D__%’
No correct answer here, the correct SQL query would be: SELECT * FROM EMPLOYEES WHERE FIRST_NAME LIKE 'D__%'; Notice there 2 underscores;
the table name CUSTOMERS table, from where you came with EMPLOYEES ? ex: WHERE CustomerName LIKE 'a_%' --> Finds any values that start with "a" and are at least 2 characters in length https://www.w3schools.com/sql/sql_like.asp