Tips>>SQL

MAKE FULL WEB APPLICATION WITH JUST SQL KNOWLEDGE? CLICK HERE

 

The IN function helps reduce the need to use multiple OR conditions. The IN operator may be used if you know the exact value you want to return for at least one of the columns. SQL IN statement can be used with where clause to list a set of matching records of a table. We can use SQL IN query with NOT combination also to filter out some records.

 

The syntax for the IN function is:

SELECT columns
FROM tables
WHERE column1 in (value1, value2, .... value_n);

EXAMPLE I :-

"Table"

SR NO
NAME
GRADE
PERCENTAGE
1
Pavan Shah
A
82.92%
2
Deepali Shah
A
75.00%
3
Chintan Desai
C
43.23%
4
Urvi Chopra
B
63.89%
5
Parin Thakkar
A
70.12%
6
Manan Sagar
C
48.23%
7
Mihir Verma
B
64.65%

In SQL :-

We will apply in command to display records of Grade A only.

SELECT * FROM `student` WHERE Grade IN ("A")

RESULT:-

SR NO
NAME
GRADE
PERCENTAGE
1
Pavan Shah
A
82.92%
2
Deepali Shah
A
75.00%
3
Parin Thakkar
A
70.12%

 

 

 

If you don't find what you are looking for. Please click here to submit your query, our experts will reply soon.

E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641