AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

SQL BETWEEN Operator - example

The BETWEEN operator selects values within a given range from database. The values - BETWEEN - can be numbers, text, or dates.
BETWEEN Syntax
Example 1: WHRE - BETWEEN Syntax
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;


SQL BETWEEN Operator - how to create - example


Demo Database
Below is a selection from the "Products" table in database:

ID Product_Name ID_SUP ID_CAT Unit Price
1 Shirts 12 3 20 pieces 26
2 T-shirts 12 3 24 pieces 11
3 Sport shoes BIC 14 2 26 pairs 36
4 Shoes NiKE 23 1 48 pairs 67
5 Sport shoes BAC 23 1 36 pairs 24.35

BETWEEN Example
The following SQL statement from above database selects all products with a price BETWEEN 11 and 21:

Example 1
SELECT * FROM Products
WHERE Price BETWEEN 20 AND 30;

NOT BETWEEN Example
To display the products from database outside the range of the previous example, use NOT BETWEEN:

Example 2
SELECT * FROM Products
WHERE Price NOT BETWEEN 10 AND 20;

Note: The values for BETWEEN can be numbers, text, or dates. The BETWEEN operator in SQL is inclusive: begin and end values are included.



sql between
SQL BETWEEN Operator - sql tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Home - Database
SQL - Database
SQL Syntax
SQL Select Data
SQL Insert Data
SQL Update
SQL Delete Row
PHP mysqli_query()
SQL order
SQL Create Database
SQL Display Data
SQL Count()
SQL mysqli_connect
SQL create table
SQL Where And & Or
SQL like Syntax
SQL Between Operator
SQL IN Operator
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


jQuery replace...
jQuery replaceClass...
jQuery click ()...
jQuery switchClass()...
jQuery draggable()...
jQuery HTML...
jQuery scroll smooth...
jQuery scroll()...
jQuery stop()...
jQuery animate()...
jQuery SlideToggle()...
jQuery slideDown()...
jQuery slideUp()...
jQuery fadeToggle...
jQuery fadeOut()...
jQuery fadeIn()...
jQuery Effects - hide () and show ()...
jQuery Events...
jQuery Attributes...
jQuery Selectors...