IN and NOT IN Operators in SQL || Lesson 52 || DBMS || Learning Monkey ||

preview_player
Показать описание
IN and NOT IN Operators in SQL

In this class, we will understand IN and NOT IN Operators in SQL.

We have already discussed the concepts of IS NULL and IS NOT NULL.

IN and NOT IN Operators in SQL
List of values testing operators

Before understanding IN and NOT IN Operators in SQL, we will understand the list of values testing operators.

In our previous classes, we have understood the single value testing operator.

Operators which can Test a List of values.

These operators are used to test from a list of values.

There are four types of operators.

IN
NOT IN
BETWEEN
NOT BETWEEN

In this class, we will try to understand IN and NOT IN Operators in SQL.
IN Operator in SQL

To understand this, we will consider the table of values given below.

From the above table, we would like to display the details of the students whose salary is equal to 100 or 300 or 500.

The query is as shown below.

SELECT * FROM students WHERE salary IN (100, 300, 500);

From the above table and query, we can select the students whose salary is 100 or 300 or 500.

The output of the query is as shown below.

NOT IN Operator in SQL

Similar to the above, we can also select the rows NOT IN the given list of values.

NOT IN is just the opposite of the IN operator.

The query with the use of NOT IN is as shown below.

SELECT * FROM students WHERE salary IN (100, 300, 500);

The output of the query is as shown below.

#learningmonkey #dbms #placements #gatecse #gatedbms #campusplacements

Link for playlists:

Рекомендации по теме