Database Reference
In-Depth Information
Figure 21.3
CREATE INDEX
Syntax.
, CD.PRESSED_DATE AS RELEASED
FROM MUSICCD CD, CDTRACK T, ARTIST A, SONG S
WHERE CD.PRESSED_DATE BETWEEN '01-JAN-01' AND '31-DEC-01'
AND T.MUSICCD_ID = CD.MUSICCD_ID
AND S.SONG_ID = T.SONG_ID
AND A.ARTIST_ID = S.ARTIST_ID;
The table is created with a subquery, so data is inserted as the table is
created. Look at the rows created in the new RELEASESIN2001 table you
have just created. The result of the query is shown in Figure 21.4.
SET WRAP OFF LINESIZE 100
COLUMN CD FORMAT A16
COLUMN ARTIST FORMAT A12
COLUMN COUNTRY FORMAT A8
COLUMN SONG FORMAT A36
SELECT * FROM RELEASESIN2001;
Now let's create some indexes on our RELEASESIN2001 table. First,
create an index on the CD column. This is a nonunique index because the
CD name repeats for each song on the CD.
CREATE INDEX RELEASES_CD ON RELEASESIN2001 (CD);
Search WWH ::




Custom Search