0

SQL LIKE

SELECT * FROM employees WHERE Salary LIKE '3%' OR Salary LIKE '4%' OR Salary LIKE '5%'; How exactly to simplify this using IN instead of OR? I did try the following but I unfortunately failed: SELECT* FROM employees WHERE Salary LIKE IN ('3%', '4%', '5%'); Also, I even swapped LIKE and IN, but still failed :(. plz help, thanks :D

21st Jun 2016, 6:59 PM
Krishna Limani
Krishna Limani - avatar
4 Answers
+ 3
select * from employees where salary like'[345]%'; this is right answer
22nd Jun 2016, 3:39 AM
Alfahad Mahimi
Alfahad Mahimi - avatar
+ 2
"There is no combination of LIKE & IN in SQL, much less in TSQL (SQL Server) or PLSQL (Oracle). Part of the reason for that is because Full Text Search (FTS) is the recommended alternative." (Source: Stackowerflow)
21st Jun 2016, 9:04 PM
M. Belog
M. Belog - avatar
+ 2
its called wild cards visit www.w3schools.com for learning sql iy gives best education online as they have options to try sql online by giving right examples
22nd Jun 2016, 3:41 AM
Alfahad Mahimi
Alfahad Mahimi - avatar
0
select * from employees where substring(salary,1,1) in ('3','4','5');
30th Jun 2016, 7:17 PM
Lucas Portela
Lucas Portela - avatar