Is it possible to define a range for the IN part of the query, something like this
SELECT job FROM mytable WHERE id IN (10..15);
Instead of
SELECT job FROM mytable WHERE id IN (10,11,12,13,14,15);
IN(start,end): It means that the intermediate value between start and end won't get displayed. For the above logic, you can use BETWEEN. BETWEEN clause is inclusive, for example, suppose there are 1,2,3,4,5,6 numbers.
You have to use the LIMIT clause in the SELECT query. MySQL allows you to set two parameters for the clause, the offset (first parameter) and the number of rows to fetch (second parameter). SELECT * FROM `ABC` LIMIT 0, 100 SELECT * FROM `ABC` LIMIT 100, 100 SELECT * FROM `ABC` LIMIT 200, 100 -- etc...
The MySQL BETWEEN OperatorThe BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The BETWEEN operator is inclusive: begin and end values are included.
You can't, but you can use BETWEEN
SELECT job FROM mytable WHERE id BETWEEN 10 AND 15
Note that BETWEEN
is inclusive, and will include items with both id 10 and 15.
If you do not want inclusion, you'll have to fall back to using the >
and <
operators.
SELECT job FROM mytable WHERE id > 10 AND id < 15
To select data in numerical range you can use BETWEEN
which is inclusive.
SELECT JOB FROM MYTABLE WHERE ID BETWEEN 10 AND 15;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With