In my database table there are two fields named salary_to and salary_from.Now in front end of my website user can enter a salary in an input field say 20000.Now i wanna perform a check in the database that if any row have salaryto and salaryfrom between which the value ‘20000’ lies.
My desired algo looks like something like this
SELECT all ROW where salaryto is less than 20000 and salaryfrom is greater than 20000
Can i use the between operator to perform this kind of filterring or i just ave to use >,< operator to this?
Provided that I’m using mysql database for my project.
The between operator is
INCLUSIVEmeaning it includes the START and END Value. While< >are exclusive.So the rows that are fetched here are with
salarytovalue of 19999 and below ANDsalaryfromvalue of 20001 and above, assuming that it increases by 1.