Database Reference
In-Depth Information
Figure 5.1
The SELECT
Statement Plus the
Optional WHERE
Clause.
Figure 5.1 shows the basic syntax of the SELECT statement including
the WHERE clause. Examining the syntax diagram in Figure 5.1, we could
do any of the following:
SELECT * FROM ARTIST WHERE ARTIST_ID = 1;
SELECT A.* FROM ARTIST A WHERE A.ARTIST_ID = 1;
SELECT * FROM MUSIC.ARTIST WHERE MUSIC.ARTIST.ARTIST_ID = 1;
SELECT A.* FROM MUSIC.ARTIST A WHERE A.ARTIST_ID = 1;
SELECT MUSIC.ARTIST.* FROM MUSIC.ARTIST
WHERE MUSIC.ARTIST.ARTIST_ID = 1;
SELECT ARTIST.* FROM MUSIC.ARTIST
WHERE MUSIC.ARTIST.ARTIST_ID = 1;
5.1.1
Some Simple WHERE Clause Examples
Here is a query with a very simple WHERE clause restricting by date:
SELECT S.TITLE, S.RECORDING_DATE
FROM SONG S
WHERE S.RECORDING_DATE > '01-JUL-2001';
The query asks for a report of songs (listing the titles and recording
dates) that were recorded before July 1, 2001. Figure 5.2 shows the query
and the results. Notice in the WHERE clause, we used a column on the left
Search WWH ::




Custom Search