Difference between >= and <= and between keyword in SQL serv
What is the difference between >= and <= and between keyword in SQL server.Please give an example.
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 3, 2013, 9:20 PM EDT
http://stackoverflow.com/questions/1960801/why-use-the-between-operator-when-we-can-do-without-it
http://stackoverflow.com/questions/921282/compare-performance-difference-of-t-sql-between-and-operator
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 4, 2013, 12:18 AM EDT
Between keyword perform > and < opration so start value and and value is not part of your query result while in >= and <=, start and end value may be a part of you query result.
Note: for Between you have write single time expression where as <= and >= you have to write expression mutliple time.
hope this will help you.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 12:39 AM EDT
'>=' and '<=' are much faster then between keyword. The between will filter rows after reading all the records where as >= and <= will check first the condition and pull the records. Please refer the below screen shot
using between
using >= and <=
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 9, 2013, 10:54 PM EDT
Your example says that between is slower than <=,>=. am i right???
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 9, 2013, 11:06 PM EDT
Regards,
Iftikar