+ 1

Can we replace BETWEEN X AND Y by > and < !!?

SELECT * FROM people WHERE id BETWEEN 10 and 21 ; ................................,..,., it will be :: ..................................... SELECT * FROM people WHERE id>10 and id<=20 ;

18th May 2017, 11:51 AM
Brahim Chai
Brahim Chai - avatar
5 odpowiedzi
+ 4
Yes, You can use anyone of them and there is no performance difference also. So you can use anything as your wish.
18th May 2017, 1:10 PM
Naga Durga Surya Prakash Donga
Naga Durga Surya Prakash Donga - avatar
+ 3
thanks
18th May 2017, 12:22 PM
Brahim Chai
Brahim Chai - avatar
+ 2
Yes you can... but the where clause should be where id >= 10 and id <= 21 as the between clause includes the lower and upper bounds.
18th May 2017, 12:19 PM
Álvaro
+ 2
Of course! Make sure you include the equal sign in the comparison if you want to catch the bounds of your interval
19th May 2017, 7:10 AM
Claudiu Ionica
Claudiu Ionica - avatar
+ 1
Of course
26th May 2017, 3:26 PM
Ben Ho
Ben  Ho - avatar