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

PHP forms
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

3282. Display data from SQL database with MySQLi into php - html table, sql tutorial
Display data from SQL database with MySQLi into php - html table sql tutorial
https://www.agernic.com/sql-tutorial/display-data-from-sql-database-with-mysqli-into-php-html-table.html

2580. SQL MIN - SQL Tutorial

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

2086. SQL Tutorial | Database Tutorial | Examples
SQL Tutorial for SQL Server. For beginners with examples.
https://www.dofactory.com/sql/tutorial

3291. SQL IN Operator - example, sql tutorial
SQL IN Operator - example sql tutorial
https://www.agernic.com/sql-tutorial/sql-in-operator-with-example.html

2566. SQL BETWEEN - SQL Tutorial

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

2570. SQL DELETE - SQL Tutorial

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

Your add here
PHP strip_tags() function

PHP strcmp() function

PHP wordwrap() function

PHP ltrim() function

PHP str_split() function

PHP strlen() function

PHP strrchr() Function

PHP isset() Function

PHP printf() function

PHP str_repeat() function

PHP similar_text() function

PHP strstr() function

PHP explode() function

PHP trim() function

PHP str_replace() function

PHP strtoupper() function

How to add text, paragraf in HTML
HTML Text Size
CSS background image opacity without affecting child elements, text or
CSS Class and ID, The Difference Between ID and Class
PHP switch Statement
How to include, how to incorporate CSS in HTML