Codefixer - ASP tutorials, resources and software
ASP.NET 3.5/2.0 Hosting – Click Here
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Tuesday 13 May
MembersPro PayPal - ASP Membership software

asp.netPRO “Best ASP.NET Host” – DiscountASP.NET


ASP Partner ASP Partner ASP Partner more partners...

SQL explained: What is SQL | Select Statement | Select Where | Insert | Update/Edit | Delete | Order By | Select Between

SQL Statement Between

The SQL Between operator can be used to select a range of data between two values.

Syntax: SELECT * FROM TableName WHERE FieldName BETWEEN value1 and value2

The values can be either dates, numbers or text.
If we wanted to select all the records from our table 'Members_tbl' in diagram 1 where the FirstName field was between 'Dave' and 'Henry' we could use the following SQL Statement.

SELECT * FROM Members_tbl WHERE FirstName BETWEEN 'Dave' and 'Henry'

Diagram 1
SQL Between

If we wanted to select all the records that didn't fall into the range we could use the NOT operator as below.

SELECT * FROM Members_tbl WHERE FirstName NOT BETWEEN 'Dave' AND 'Henry'

If we had a database table called tblProducts which had a field product_names and another field product_price we could use the BETWEEN operator to retrieve all products with a price between $20 and $40. Our SQL statement below demonstrates this.

SELECT * FROM tblProducts WHERE Product_price BETWEEN 20 AND 40

The SQL Between will include the specified start and end values, so in our example above products with prices of 20 and 40 will be included.





ASP.NET 3.5/2.0 Web Hosting: 3 Months FREE – Click Here!




About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software