Question 1.
You need to display the last names of those employees who have the letter "A" as the second character in their names.
Which SQL statement displays the required results?
A. SELECT last_nameFROM EMPWHERE last_name LIKE '_A%';
B. SELECT last_nameFROM EMPWHERE last name ='*A%'
C. SELECT last_nameFROM EMPWHERE last name ='_A%';
D. SELECT last_nameFROM EMPWHERE last name LIKE '*A%'
Answer: A
Explanation:
Statement in this answer will show correct results because usage of operator LIKE and format mask '_A%' extract the last names of those employees who have the letter 'A' as the second character in their names. Symbol '_' in format mask substitute exactly one symbol and cannot be NULL.
Incorrect Answers
B: This statement will return only names starting from symbol '*'. It cannot be used as substitution symbol.
C: Usage of equity operator here is not appropriate in this case: query will look exact for first symbol '_', it will not be considered as substitution symbol.
D: This statement will return only names starting from symbol ' *'. It cannot be used as substitution symbol.
You need to display the last names of those employees who have the letter "A" as the second character in their names.
Which SQL statement displays the required results?
A. SELECT last_nameFROM EMPWHERE last_name LIKE '_A%';
B. SELECT last_nameFROM EMPWHERE last name ='*A%'
C. SELECT last_nameFROM EMPWHERE last name ='_A%';
D. SELECT last_nameFROM EMPWHERE last name LIKE '*A%'
Answer: A
Explanation:
Statement in this answer will show correct results because usage of operator LIKE and format mask '_A%' extract the last names of those employees who have the letter 'A' as the second character in their names. Symbol '_' in format mask substitute exactly one symbol and cannot be NULL.
Incorrect Answers
B: This statement will return only names starting from symbol '*'. It cannot be used as substitution symbol.
C: Usage of equity operator here is not appropriate in this case: query will look exact for first symbol '_', it will not be considered as substitution symbol.
D: This statement will return only names starting from symbol ' *'. It cannot be used as substitution symbol.
Comments