-
SQL Installing SSMS
-
SQL Syntax
-
SQL Datatype
-
SQL Database
-
SQL Table
-
SQL Select
-
SQL Distinct
-
SQL Count
-
SQL Top
-
SQL Aliases
-
SQL In
-
SQL Insert
-
SQL Update
-
SQL Null
-
SQL Like
-
SQL Wildcards
-
SQL Nested Query
-
SQL Between
-
SQL Unique
-
SQL Primary Key
-
SQL Foreign Key
-
SQL Check
-
SQL Default
-
SQL Database Diagram
-
SQL Stored Procedures
-
SQL Joins
-
SQL Inner Join
-
SQL Left Join
-
SQL Right Join
-
SQL Full Join
-
SQL Trigger
SQL Select In
SQL IN is an operator used in a SQL query to help reduce the need to use multiple SQL “OR” conditions. The IN operator allows you to specify multiple values in a WHERE clause. It is used in SELECT, INSERT, UPDATE, or DELETE statements.
Example:
Expression IN (value 1, value 2 … value n);
We have a table called Employee with four columns:
Take an example with character values.
SELECT * FROM Employee WHERE Emp_Name IN (Ankit, Bheem, Sumit);
The result will be shown as this table:
The result will be shown as this table:
SELECT * FROM Employee WHERE Emp_Salary IN (25000, 30000, 40000);
The result will be shown as this table:
Course Video
NOTE: Practice below questions on site editor.
1. Write SQL Query to get all the records from Person_Person table whose BusinessEntityID is 1, 5 and 10 using IN operator.
Table: (Person_Person)-(3 row count)
2. Write SQL Query to get all the records from Production_Culture table where Name is ‘Arabic’,
‘English’,’Thai’ using IN operator
Table: (Production_Culture)-(3 row count)
3. Make a SQL Query to find Name, ShiftID from HumanResource_Shift table where Name is (Day, Night, Evening) using IN operator.
Table: (HumanResource_Shift)-(3 row count)
4. Write SQL Query to get all the columns from HumanResources_EmployeePayHistory table where BusinessEntityID is (1,2,3,4) and Rate is less than 50 Using IN operator.
Table: (HumanResources_EmployeePayHistory)-(4 row count)
5. Write a SQl Query to get all the records from HumanResources_EmployeePayHistory table where BusinessEntityID is (1,2,3,4,5,6) and Rate is grater than 50 Using IN operator.
Table : (HumanResources_EmployeePayHistory)-(6 row count)
YouTube Reference :
1) SQL Select In in Hindi/Urdu
2) SQL Select In in English