0
The difference between command LIMIT and BETWEEN
What is the difference between LIMIT and BETWEEN if both does the same thing?
3 Answers
+ 3
â LIMIT sets a limit of how many matching records to be returned from the result set.
SELECT * FROM contacts LIMIT 5;
â BETWEEN returns a boolean {true} when the left-hand operand value lies between the value range of the two right-hand operands, and {false} otherwise. For example:
SELECT birthday FROM contacts WHERE birthday BETWEEN '2019-01-01' AND '2019-08-17';
birthday: a column to filter with, the left-hand operand.
'2019-01-01' and '2019-08-17' is the value range (right-hand operands) to which birthday was to be checked against.
Hth, cmiiw
0
- Using LIMIT you set a limit of how many matching records to be returned from the result set.
- Using BETWEEN (totally different) you specify a range starting from a first value to a second value, that range will be use in your query.
0
LIMIT - You will get the records as per the number which you have provided to limit either from starting or from last,Here you cannot pull the records which are in the middle of the table.
BETWEEN - You will get the records as per the limitations set by you (EX: 10&20)