0

The difference between command LIMIT and BETWEEN

What is the difference between LIMIT and BETWEEN if both does the same thing?

16th Jan 2019, 2:45 PM
Cezary Hawryło
3 Respuestas
+ 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
16th Jan 2019, 3:09 PM
Ipang
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.
16th Jan 2019, 7:06 PM
Marcos Carrizo
Marcos Carrizo - avatar
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)
30th Jan 2019, 3:32 PM
Harish
Harish - avatar