TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Oracle

Oracle SQL BETWEEN Operator with Examples

Overview

Oracle SQL BETWEEN operator allows us to specify a range in the WHERE clause to fetch rows. We can use the BETWEEN AND operator in the WHERE clause.

Syntax

SELECT columns FROM table_name

WHERE  col_name BETWEEN <startexpr> AND <endexpr>;

To exclude the given range we can use the NOT operator.

SELECT columns FROM table_name

WHERE  col_name NOT BETWEEN <startexpr> AND <endexpr>;

Example

Given table

SQL> SELECT empno, ename, sal FROM employee;

 EMPNO ENAME SAL
---------- -------------------- ----------
 7369 SMITH 800
 7499 ALLEN 1600
 7521 WARD 1250
 7566 JONES 2975
 7654 MARTIN 1250

We will write a query to find employees who earn salaries between 1000 and 2000.

SQL> SELECT empno, ename, sal FROM employee
WHERE sal BETWEEN 1000 AND 2000;

EMPNO     ENAME                  SAL
———-     ——————– ———-
7499           ALLEN                   1600
7521            WARD                    1250
7654           MARTIN                1250

 

Oracle SQL BETWEEN Operator

—

Oracle Database Tutorials on this website:

https://www.testingdocs.com/oracle-database-tutorials-for-beginners/

More information about Oracle Database:

https://www.oracle.com/database/

Related Posts

Download SQL Developer

Oracle /

Download Oracle SQL Developer

Oracle Databse 19c Download

Oracle /

Install Oracle 19c Database On Windows 10

ORA-01109 Database Not Open

Oracle /

Fix ORA-01109: database not open Error

Oracle SQL Update Statement

Oracle /

Oracle SQL Update Statement

Oracle SQL Insert Statement

Oracle /

Oracle SQL INSERT Statement

‹ Oracle Rename Table Statement› Oracle Administrative User Accounts

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version