IN is an SQL operator used to compare a value against a list of values. It returns TRUE if the value matches any value in the list. It's often used in the WHERE and HAVING clauses of SQL statements.
Example
Output
Explanation
The SQL IN keyword allows you to select records from a set of specific values. Here, it selects customers whose countries are either ‘Germany’, ‘France’ or ‘UK’.
Example
Output
Explanation
The IN operator is used in the WHERE clause to filter the records. In this example, it filters out the employees whose EmployeeID is either 1, 2, or 3. So, it basically selects records from the Employees table where the EmployeeID is in the list of specified values.
Example
Output
Explanation
The provided SQL statement retrieves all records from the ‘Employees’ table where the ‘DepartmentID’ is either 3, 4, or 7. The IN keyword in SQL is used to compare a value to a list of literal values that have been specified. In this case, it is comparing ‘DepartmentID’ to the list (3, 4, 7).
Example
Output
Explanation
The provided SQL query fetches a list of all employees who belong to departments with IDs 10, 20, and 30. If any employee’s department_id value is one of the provided values in the IN keyword list, that employee information is displayed in the output. If not, their information is ignored.
Example
Output
Explanation
The SQL query selects all fields for the records in the ‘Employees’ table where the ‘Department’ field is either ‘Marketing’ or ‘Sales’.
For in-depth explanations and examples SQL keywords where you write
your SQL, install our extension.