ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

What will be the output of the following MySQL statement?
SELECT *
FROM employee
WHERE lname LIKE ‘F%’ OR lname LIKE ‘%T’;

Answer & Solution
Correct Answer: Option C
This question is asking about how to use the LIKE operator in MySQL to find employees with specific patterns in their last names. Let's break it down:
The LIKE operator is used for pattern matching. The percent sign (%) is a wildcard that represents zero or more characters.
Here's how the statement works:
* `lname LIKE ‘F%’`: This part finds employees whose last names start with the letter 'F' followed by any number of other characters.
* `lname LIKE ‘%T’`: This part finds employees whose last names end with the letter 'T', and can have any characters before it.
* `OR`: The OR keyword means that the query will return employees who meet either condition.
Therefore, the correct answer is Option D: None of the mentioned. The query will return all employees whose last name starts with 'F' OR ends with 'T'. It won't necessarily include employees whose last names both start with 'F' and end with 'T'.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.