★ wanayoo — archive 1999 http://wdvl.com/Authoring/DB/Intro/in.htmlNouvelle recherche | Portail wanayoo

The leading seminar for Affiliate Marketing on the Internet. logo

internet.com
Join the free
WDVL newsletter!

home

In

September 13, 1998

Like BETWEEN, the IN operator is used as a shorthand to specify multiple parameters in one statement. The IN operator looks generically like:

SELECT column_name
FROM table_name
WHERE column_name IN ('value', 'value', value);

The reverse, or course, looks like:

SELECT column_name
FROM table_name
WHERE column_name NOT IN ('value', 'value', value);

As you might have guessed, the IN operator works just the same as stringing multiple OR's together. The list of comma separated values defines a set of acceptable conditions. Thus, to get a listing of all the clients in the 90031 or the 90102 zip codes, you could string together OR operators such as:

SELECT C_NAME, C_ZIP
FROM CLIENTS
WHERE C_ZIP = 90031 OR C_ZIP = 90102;

Or using the IN operator, you would have:

SELECT C_NAME, C_ZIP
FROM CLIENTS
WHERE C_ZIP IN ('90031', '90102');

In either case, you'd get the following results:

    C_NAME			C_ZIP
    -------------------------------
    Rick Tan			90031
    Stephen Petersen		90102
    -------------------------------

Between
Introduction to Databases for the Web | Table of Contents
Like

Up to => Home / Authoring / DB / Intro

Instantly look up a "techie" word using Webopedia!!


internet.com
e-commerce
WebDeveloper Network


When you're ready to play with the big boys

Copyright 1999 internet.com Corporation. Legal Notices. Privacy Policy.

www.internet.com