WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

SQL InOperator


IN operator

The

IN operator allows you to specify multiple values in the WHERE clause.

SQL IN syntax

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


Demo database

In this tutorial, we will use the welookups sample database.

Here is the data from the "Websites" table:

+----+--------------+---------------------------+-------+---------+
| id | name         | url                       | alexa | country |
+----+--------------+---------------------------+-------+---------+
| 1  | Google       | https://www.google.cm/   | 1     | USA     |
| 2  |           | https://www.yahoo.com/  | 13    | IN      |
| 3  | Indiatimes      | http://www.Indiatimes.com/   | 4689  | IN            |
| 4  | zomato          | http://zomato.com/        | 20    | IN            |
| 5  | Facebook     | https://www.facebook.com/| 3     | USA     |
| 7  | stackoverflow | http://stackoverflow.com/|   0 | IND     |
+----+---------------+---------------------------+-------+---------+


IN operator example

The following SQL statement selects all sites whose name is "Google" or "WelookupsTutorial":

Example

SELECT * FROM Websites
WHERE name IN ('Google', 'WelookupsTutorial');



Welookups is optimized for learning.Copy right 2018 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.

welookups.comWelookups Javacodegeeks