What will be the output of the following MySQL statement?
SELECT *
FROM employee
WHERE lname LIKE ‘F%’ AND lname LIKE ‘%T’;
SELECT *
FROM employee
WHERE lname LIKE ‘F%’ AND lname LIKE ‘%T’;
A. All employees whose last name should started with 'F' and end with 'T'
B. All employees whose last name start with 'T' and end with 'F'
C. All employees whose last name should started with 'F' and end with 'F'
D. None of the mentioned
Answer: Option A
Solution (By Examveda Team)
This question asks about how the LIKE operator works in MySQL. Let's break down the code:SELECT * FROM employee : This part selects all the columns (*) from the table named 'employee'.
WHERE lname LIKE ‘F%’ AND lname LIKE ‘%T’ : This part filters the results based on the 'lname' (last name) column.
LIKE ‘F%’ : This checks if the last name starts with the letter 'F'. The '%' symbol acts as a wildcard, meaning it can match any number of characters.
LIKE ‘%T’ : This checks if the last name ends with the letter 'T'. Again, the '%' symbol allows for any number of characters before the 'T'.
In summary, this query will only return employees whose last name starts with 'F' and ends with 'T'.
Therefore, the correct answer is Option A: All employees whose last name should started with 'F' and end with 'T'.
Related Questions on MySQL Miscellaneous
How is communication established with MySQL?
A. SQL
B. Network calls
C. A programming language like C++
D. APIs
Which type of database management system is MySQL?
A. Object-oriented
B. Hierarchical
C. Relational
D. Network
Join The Discussion