between operator SQL

between :-  this operator is used to represent all data values between given range. here lower and upper both limits are included. this keyword is used with where clause.

Syntax :- select*from table_name where column_name between A and B;

Example :- 

1. display all records from sells table whose order price lies between 1000 and 5000.

i/p :- select*from sells where order_price between 1000 and 5000;

o/p :-
orderID
Order price
Quantity
Cust_name
4
1050
3
Kavita
5
3000
4
Himanshu
10
4000
8
Ravi

2. display customer name from sells whose quantity lies between 2 and 4.

i/p :- select cust_name from sells where quantity between 2 AND 4.

o/p :-
orderID
Order price
Quantity
Cust_name
4
1050
3
Kavita


No comments:

Post a Comment

Nested SQL Query or SQL Sub Query in hindi in english

if a SQL query is used inside another SQL query then this type of SQL query is called sub-query.  यदि किसी SQL क्वेरी का उपयोग, किसी अन्य SQ...