SQL Tutorial will guide us now IN SQL keyword, there are two uses of the SQL IN keyword,
and this SQL Tutorial section introduces the one that is related to
the SQL WHERE clause. When used in this context, we know exactly
the value of the returned values we want to see for at least
one of the columns. The syntax for using the SQL IN keyword is as
follows:
The number of values in the parenthesis can be one or more as required,
with each values separated by comma. Values can be numerical or
characters or both. If there is only one value inside the parenthesis,
this commend is equivalent to
For example, we may wish to select all records for the Employee Creston and
Bobbi
in the table of Employees.
Table:
Employees
| FirstName |
LastName |
Email |
DOB |
Phone |
| Austin |
Hennery |
austin.it@gamail.com |
24/11/1978 |
446 102-2222 |
| Creston |
Narvon |
narvon_crest@hotmail.com |
22/04/1976 |
443 325-4545 |
| Kate |
Bladen |
kbladen@usa.net |
01/05/1980 |
326 503-3232 |
| Angela |
Julie |
julieee@yahoo.co.uk |
11/12/1977 |
326 323-8888 |
| Bobbi |
Ferguson |
bobi123@kiwibox.com |
10/02/1970 |
506 252-9875 |
| Cute |
Alfa |
cafa@gmail.com |
19/05/1972 |
506 272-4566 |