Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


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




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers