Database Reference
In-Depth Information
Figure 18.18
ALTER TABLE
syntax.
18.4.1
Adding, Modifying, and Removing Columns
First we create a new table using a subquery on some of the MUSIC schema
tables. The following script creates a table named RELEASESIN2001. The
table has five columns: CD, ARTIST, COUNTRY, SONG, and
RELEASED.
CREATE TABLE RELEASESIN2001 (CD,ARTIST,COUNTRY,SONG,RELEASED)
AS SELECT CD.TITLE AS "CD", A.NAME AS "ARTIST"
, A.COUNTRY AS "COUNTRY", S.TITLE AS "SONG"
, 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;
Now we need to examine the table we have just created. See the result in
Figure 18.19.
SET LINESIZE 100
DESC RELEASESIN2001
Search WWH ::




Custom Search