CLAUSE:  WHERE

DELETE [table | *] FROM table WHERE selectcriteria

SELECT table | * FROM table WHERE selectcriteria

UPDATE table SET newvalue WHERE selectcriteria

 
The WHERE clause is used with the DELETE, SELECT, and UPDATE statements to specify a selection criteria.
 
However, the WHERE clause is optional. Consider the following SELECT example which does not use a WHERE. This simple query will return all rows from the table SongWriters:
 
SELECT * FROM SongWriters;
 
The addition of a WHERE to the previous example allows you to efficiently narrow the values that will be selected. In this example, we narrow the criteria to only 'Jazz':
 
SELECT * FROM SongWriters WHERE MusicType='Jazz';
 
By using the AND logical operator we can further narrow the criteria:
 
SELECT * FROM SongWriters WHERE MusicType='Jazz' AND YearWritten=1940;
 
You can also use the OR logical operator:
 
SELECT * FROM SongWriters WHERE MusicType='Jazz' OR MusicType='Blues';
 
Within a WHERE clause, you can link up to a total of forty (40) expressions using logicical operators:
 
SELECT * FROM SongWriters WHERE MusicType='Jazz' OR MusicType='Blues' OR MusicType='Gospel' AND YearWritten>1939 AND YearWritten<1946;


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information