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

  • Home
  • SEARCH
  • 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 8522335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:05:14+00:00 2026-06-11T07:05:14+00:00

How do I get the numbers between 4 and 8. The answer I want

  • 0

How do I get the numbers between 4 and 8. The answer I want is 5,6,7 but the script returns 4,5,6,7,8 when used in SQL Server:

SELECT * 
FROM table
WHERE numbers BETWEEN '4' AND '8'
  • 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-06-11T07:05:15+00:00Added an answer on June 11, 2026 at 7:05 am

    BETWEEN is inclusive. From MSDN:

    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.

    Since it is inclusive you will want to use greater than and less than:

    SELECT * 
    FROM yourtable
    WHERE numbers > 4
       AND numbers < 8
    

    See SQL Fiddle with Demo

    If you want to use the BETWEEN operator then you would need to shorten the range:

    SELECT * 
    FROM yourtable
    WHERE numbers between 5 AND 7
    

    see SQL Fiddle with Demo

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

Sidebar

Related Questions

I just want to get numbers of times to be used for each Activity.
I want to how know to get certain numbers from a string in matlab.
I am trying to write a regex to get the numbers from strings like
I am trying to get list of numbers from: numbers= 1,2 to: '1','2' I
I want to get N random numbers whose sum is a value. For example,
Im trying to get random number between -5 and 5. Im using this code:
Hi I am trying to execute a query to get row between certain number
I would like to get numbers of comments for each posts using mysql. I
I'm just trying to get the numbers that are in a sentence. They can
How to get all contact numbers for a Contact when searching by contact name.

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.