What will be the output of the following SQL statement?
SELECT Ename FROM Employee WHERE Ename like '%a' and salary <= 10000;
What will be the output of the following SQL statement?
SELECT Ename FROM Employee WHERE Ename like '%a' and salary <= 10000;
Solution
In LIKE, the wildcard % stands for any number of characters (including none). The pattern '%a' therefore matches names that end with 'a'. The condition salary <= 10000 keeps only salaries less than or equal to 10000. With and, both conditions must hold, so the query returns names ending with 'a' whose salary is at most 10000.
Option 1: this would need the pattern 'a%', with the wildcard after the letter.
Option 4: this would need '%a%', with a wildcard on both sides.
Option 3: <= means less than or equal to, not greater than or equal to.
Related questions:
2025: 13 May Shift 2
2026: 13 May Shift 2
2026: 26 May Shift 1