Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6362507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:55:01+00:00 2026-05-24T23:55:01+00:00

Why this two expressions return different results? This is really stupid. SELECT * FROM

  • 0

Why this two expressions return different results? This is really stupid.

SELECT * FROM Table WHERE ID BETWEEN 3 AND 1

SELECT * FROM Table WHERE ID BETWEEN 1 AND 3
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:55:02+00:00Added an answer on May 24, 2026 at 11:55 pm

    As the documentation says:

    BETWEEN returns TRUE if the value of test_expression is greater than
    or equal to the value of begin_expression and less than or equal to
    the value of end_expression.

    Doesn’t say anything about swapping the start_expression and end_expression to match min and max values. You should expect the result as documented, not as you believe it should.

    For the curious out there, the ANSI SQL99 standard specifies that the BETWEEN predicate should include a clause for SYMMETRIC or ASYMMETRIC comparison. Only the SYMMETRIC one is allowed to swap the start_range and end_range, the ASYMMETRIC one is required to be strict. The ASYMMETRIC form is the implicit form. In other words an implementation that interprets A BETWEEN X and Y as (A>=X AND A<=Y) OR (A>=Y AND A<=X), as the OP suggests, is not standard compliant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the difference between this two codes? class SomeClass { SomeType val =
I'm designing a validation service and I'm debating between two different method signatures for
I want to compose the results of two Linq Expressions. They exist in the
I don't get the actual (semantic) difference between the two expressions. It is said
I need to get two fields from a database table (retrieved using linq-to-sql), one
I have the following two methods that get data from my DB and return
I have two expressions: public static Expression<Func<int, bool>> IsDivisibleByFive() { return (x) => x
Why this two functions have the strange behaviour of when I click on thead,
As a followup to this two questions and its answers Question 1 and Question
I have this two uls: <ul actualpage=0 id=lastcompanieslist hideable=true upperpage=1> <li page=0 style=display: none;><img

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.