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

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com