HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
HTML Tutorial

CSS Tutorial

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

2586. SQL SUM - SQL Tutorial

http://www.sql-tutorial.net/SQL-SUM.asp

2589. SQL WHERE - SQL Tutorial

http://www.sql-tutorial.net/SQL-WHERE.asp

690. MySQL Tutorial - w3resource

https://www.w3resource.com/mysql/mysql-tutorials.php

363. SQL Tutorial
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, and XML.
https://www.w3schools.com/sql/default.asp

2571. SQL DISTINCT - SQL Tutorial

http://www.sql-tutorial.net/SQL-DISTINCT.asp

2598. SQL tutorial will teach you how to use SQL - Database, sql tutorial
SQL tutorial will teach you how to use SQL - Database sql tutorial
http://www.agernic.com/sql-tutorial/sql-tutorials-sql-database.html

Your add here
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL BETWEEN Operator
SQL like syntax and example
SQL WHERE AND & OR multiple conditions
SQL create table primary key autoincrement
PHP mysqli_connect () Function
SQL COUNT(), AVG() and SUM() Functions
Display data from SQL database with MySQLi into php - html table
SQL CREATE DATABASE - example
SQL mysql order by columns, by date, by asc, by desc, random with PHP
PHP mysqli_query() Function - mysqli query
SQL delete row - SQL delete table
SQL update - SQL update select
Insert into SQL - Insert into table SQL - Insert data in sql
Login in PHP - simple login script with PHP MYSQL