ITP

BSc IT - Database Management System

Explain use of IN, BETWEEN operators with example.

In : BSc IT Subject : Database Management System

In SQL, the IN operator is used to check if a value matches any value in a list. It makes it easy to write multiple `OR` conditions in a short way. For example, if you want to find students from India, USA, or UK, you can write:  

SELECT * FROM Students WHERE Country IN ('India', 'USA', 'UK');


The BETWEEN operator is used to select values that fall in a range, such as numbers, dates, or text. For example, to find employees with salaries between 20,000 and 50,000, you can use:  

SELECT * FROM Employees WHERE Salary BETWEEN 20000 AND 50000;


Both operators are used in the `WHERE` clause to filter data based on one or more values (`IN`) or a specific range (`BETWEEN`), making queries easier and more readable.

About us

A truly open platform where you may ask questions and get answers. We also provide comprehensive and easy-to-understand answers to question papers.  discover...

Site status

Flag Counter

Privacy Policy

Sitemap