Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 50 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
50
Dung lượng
609,92 KB
Nội dung
570
A.3
SCHEMAOLTP.SQL
A.2 CREATEUSER.SQL
SPOOL log/CREATEUSER.LOG;
DROP USER MUSIC CASCADE;
CREATE USER MUSIC IDENTIFIED BY MUSIC
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
QUOTA UNLIMITED ON USERS
QUOTA UNLIMITED ON TEMP;
GRANT CONNECT,RESOURCE TO MUSIC;
GRANT UNLIMITED TABLESPACE TO MUSIC;
SPOOL OFF;
A.3 SCHEMAOLTP.SQL
SPOOL log/SCHEMA_OLTP.LOG;
DROP TABLE INSTRUMENT CASCADE CONSTRAINTS;
CREATE TABLE INSTRUMENT
(
INSTRUMENT_ID NUMBER NOT NULL
,SECTION_ID NUMBER NULL
,NAME VARCHAR2(32) NOT NULL
,CONSTRAINT XPKINSTRUMENT PRIMARY KEY (INSTRUMENT_ID)
,CONSTRAINT FKI_1 FOREIGN KEY (SECTION_ID) REFERENCES INSTRUMENT
);
CREATE UNIQUE INDEX XUK_INSTRUMENT_NAME ON INSTRUMENT (NAME);
CREATE INDEX XFK_I_1 ON INSTRUMENT (SECTION_ID);
DROP TABLE ARTIST CASCADE CONSTRAINTS;
CREATE OR REPLACE TYPE INSTRUMENTSCOLLECTION AS VARRAY(10) OF VARCHAR2(32);
/
CREATE TABLE ARTIST
(
ARTIST_ID NUMBER NOT NULL
,NAME VARCHAR2(32) NOT NULL
,STREET VARCHAR2(32)
,POBOX CHAR(20)
,CITY VARCHAR2(32)
,STATE_PROVINCE VARCHAR2(32)
,COUNTRY VARCHAR2(32)
,ZIP CHAR(10)
,EMAIL VARCHAR2(32)
,INSTRUMENTS INSTRUMENTSCOLLECTION
Appendix_A.fm Page 570 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
A.3
SCHEMAOLTP.SQL 571
Appendix A
,CONSTRAINT XPKARTIST PRIMARY KEY (ARTIST_ID)
);
CREATE UNIQUE INDEX XUK_ARTIST_NAME ON ARTIST (NAME);
DROP TABLE SONG CASCADE CONSTRAINTS;
CREATE TABLE SONG
(
SONG_ID NUMBER NOT NULL
,ARTIST_ID NUMBER NOT NULL
,TITLE VARCHAR2(64) NOT NULL
,RECORDING_DATE DATE
,PLAYING_TIME CHAR(10)
,RECORDING BLOB
,CONSTRAINT XPKSONG PRIMARY KEY (SONG_ID)
,CONSTRAINT FKSONG_1 FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST
);
CREATE INDEX XFK_SONG_1 ON SONG (ARTIST_ID);
CREATE UNIQUE INDEX XUK_SONG_TITLE ON SONG (TITLE);
DROP TABLE GUESTAPPEARANCE CASCADE CONSTRAINTS;
CREATE TABLE GUESTAPPEARANCE
(
SONG_ID NUMBER NOT NULL
,GUESTARTIST_ID NUMBER NO NULL
,COMMENT_TEXT VARCHAR2(256)
,CONSTRAINT XPKGUESTAPPEARANCE PRIMARY KEY (SONG_ID,GUESTARTIST_ID)
,CONSTRAINT FKGUESTAPPEARANCE_1 FOREIGN KEY (GUESTARTIST_ID) REFERENCES ARTIST
,CONSTRAINT FKGUESTAPPEARANCE_2 FOREIGN KEY (SONG_ID) REFERENCES SONG
);
CREATE INDEX XFK_GUESTAPPEARANCE_1 ON GUESTAPPEARANCE (GUESTARTIST_ID);
CREATE INDEX XFK_GUESTAPPEARANCE_2 ON GUESTAPPEARANCE (SONG_ID);
DROP TABLE INSTRUMENTATION CASCADE CONSTRAINTS;
CREATE TABLE INSTRUMENTATION
(
SONG_ID NUMBER NOT NULL
,GUESTARTIST_ID NUMBER NOT NULL
,INSTRUMENT_ID NUMBER NOT NULL
,COMMENT_TEXT VARCHAR2(256)
,CONSTRAINT XPKISG PRIMARY KEY (SONG_ID,GUESTARTIST_ID,INSTRUMENT_ID)
,CONSTRAINT FKISG_1 FOREIGN KEY (SONG_ID,GUESTARTIST_ID) REFERENCES GUESTAPPEARANCE
,CONSTRAINT FKISG_2 FOREIGN KEY (INSTRUMENT_ID) REFERENCES INSTRUMENT
);
CREATE INDEX XFK_ISG_1 ON INSTRUMENTATION (INSTRUMENT_ID);
CREATE INDEX XFK_ISG_2 ON INSTRUMENTATION (SONG_ID, GUESTARTIST_ID);
Appendix_A.fm Page 571 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
572
A.3
SCHEMAOLTP.SQL
DROP TABLE GENRE CASCADE CONSTRAINTS;
CREATE TABLE GENRE
(
GENRE_ID NUMBER NOT NULL
,STYLE_ID NUMBER
,GENRE VARCHAR2(32)
,CONSTRAINT XPKGENRE PRIMARY KEY (GENRE_ID)
,CONSTRAINT FKG_1 FOREIGN KEY (STYLE_ID) REFERENCES GENRE
);
CREATE INDEX XFK_G_1 ON GENRE (STYLE_ID);
DROP TABLE MUSICCD CASCADE CONSTRAINTS;
CREATE TABLE MUSICCD
(
MUSICCD_ID NUMBER NOT NULL
,GENRE_ID NUMBER
,TITLE VARCHAR2(32)
,PRESSED_DATE DATE
,PLAYING_TIME CHAR(10)
,LIST_PRICE FLOAT
,CONSTRAINT XPKMUSICCD PRIMARY KEY (MUSICCD_ID)
,CONSTRAINT FKMCD_1 FOREIGN KEY (GENRE_ID) REFERENCES GENRE
);
CREATE UNIQUE INDEX XUK_MUSICCD_TITLE ON MUSICCD (TITLE);
CREATE INDEX XFK_MCD_1 ON MUSICCD (GENRE_ID);
DROP TABLE CDTRACK CASCADE CONSTRAINTS;
CREATE TABLE CDTRACK
(
MUSICCD_ID NUMBER NOT NULL
,SONG_ID NUMBER NOT NULL
,TRACK_SEQ_NO NUMBER NOT NULL
,CONSTRAINT XPKCDTRACK PRIMARY KEY (MUSICCD_ID,SONG_ID)
,CONSTRAINT FKCDTRACK_1 FOREIGN KEY (SONG_ID) REFERENCES SONG
,CONSTRAINT FKCDTRACK_2 FOREIGN KEY (MUSICCD_ID) REFERENCES MUSICCD
);
CREATE INDEX XFK_CDTRACK_1 ON CDTRACK (SONG_ID);
CREATE INDEX XFK_CDTRACK_2 ON CDTRACK (MUSICCD_ID);
CREATE UNIQUE INDEX XAK_CDTRACK_TRACK ON CDTRACK (MUSICCD_ID,TRACK_SEQ_NO);
DROP TABLE STUDIOTIME CASCADE CONSTRAINTS;
CREATE TABLE STUDIOTIME
(
STUDIOTIME_ID NUMBER NOT NULL
,ARTIST_ID NUMBER NOT NULL
Appendix_A.fm Page 572 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
A.5
INSTRUMENT.SQL 573
Appendix A
,SESSION_DATE DATE
,MINUTES_USED NUMBER(10,2)
,DUE_DATE DATE
,AMOUNT_CHARGED NUMBER(10,2)
,AMOUNT_PAID NUMBER(10,2)
,CONSTRAINT XPKSTUDIOTIME PRIMARY KEY (STUDIOTIME_ID)
,CONSTRAINT FKSTUDIOTIME_1 FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST
);
CREATE INDEX XFK_STUDIOTIME_1 ON STUDIOTIME (ARTIST_ID);
SPOOL OFF;
A.4 SEQUENCES.SQL
SPOOL log/SEQUENCES.LOG;
DROP SEQUENCE ARTIST_ID_SEQ;
DROP SEQUENCE SONG_ID_SEQ;
DROP SEQUENCE INSTRUMENT_ID_SEQ;
DROP SEQUENCE STUDIOTIME_ID_SEQ;
DROP SEQUENCE MUSICCD_ID_SEQ;
DROP SEQUENCE GENRE_ID_SEQ;
DROP SEQUENCE continent_ID_SEQ;
DROP SEQUENCE country_ID_SEQ;
DROP SEQUENCE retailer_ID_SEQ;
DROP SEQUENCE CUSTOMER_ID_SEQ;
DROP SEQUENCE SALES_ID_SEQ;
CREATE SEQUENCE ARTIST_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE SONG_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE INSTRUMENT_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE STUDIOTIME_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE MUSICCD_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE GENRE_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE continent_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE country_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE retailer_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE CUSTOMER_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE SALES_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
SPOOL OFF;
A.5 INSTRUMENT.SQL
SPOOL log/INSTRUMENT.LOG;
Appendix_A.fm Page 573 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
574
A.5
INSTRUMENT.SQL
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'Guitar');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'General');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'Percussion');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'Piano');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'String');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'Vocals');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'Wind');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,NULL,'Orchestra');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Guitar') ,'Acoustic Guitar');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Guitar') ,'Electric Guitar');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Wind') ,'Brass');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Wind'),'Woodwind');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Woodwind'),'Alto Horn');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass'),'Alto Saxophone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Vocals') ,'Background Vocals');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Baritone / Bass Saxophone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Woodwind') ,'Baritone Horn');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Electric Guitar') ,'Bass Guitar');
Appendix_A.fm Page 574 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
A.5
INSTRUMENT.SQL 575
Appendix A
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='String') ,'Cello');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Woodwind') ,'Clarinet');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Percussion') ,'Cymbals');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='String') ,'Double Bass');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='General') ,'Double Reeds');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Percussion') ,'Drum Machines');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Percussion') ,'Drums');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Percussion') ,'Electronic Drums');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='String') ,'Fiddle');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Wind') ,'Flugelhorn');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Wind') ,'Flute');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'French Horn');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Piano') ,'Keyboards');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Percussion') ,'Latin Percussion');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Electric Guitar') ,'Lead Guitar');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='General') ,'Mellophone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Wind') ,'Piccolo');
Appendix_A.fm Page 575 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
576
A.6
ARTIST.SQL
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Acoustic Guitar') ,'Rhythm Guitar');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Soprano Saxophone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Sousaphone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Acoustic Guitar') ,'Steel Guitar');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Tenor Saxophone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Trombone');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Trumpet');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='Brass') ,'Tuba');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='String') ,'Viola');
INSERT INTO INSTRUMENT(INSTRUMENT_ID,SECTION_ID,NAME)
VALUES(INSTRUMENT_ID_SEQ.NEXTVAL,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE
NAME='String') ,'Violin');
COMMIT;
SPOOL OFF;
A.6 ARTIST.SQL
SPOOL log/ARTIST.LOG;
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Sheryl Crow'
,INSTRUMENTSCOLLECTION('Vocals','Acoustic Guitar','Electric Guitar'));
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Barry Manilow'
,INSTRUMENTSCOLLECTION('Vocals','Piano'));
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Avril Lavigne'
,INSTRUMENTSCOLLECTION('Vocals'));
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Goo Goo Dolls',null);
Appendix_A.fm Page 576 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
A.7
GENRE.SQL 577
Appendix A
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Puddle of Mudd',null);
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Nickelback',null);
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Matchbox Twenty',null);
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS) VALUES(ARTIST_ID_SEQ.NEXTVAL,'Jewel'
,INSTRUMENTSCOLLECTION('Vocals','Acoustic Guitar'));
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'Mozart',NULL);
INSERT INTO ARTIST(ARTIST_ID,NAME,INSTRUMENTS) VALUES(ARTIST_ID_SEQ.NEXTVAL,'James
Taylor',INSTRUMENTSCOLLECTION('Vocals','Acoustic Guitar'));
COMMIT;
SPOOL OFF;
A.7 GENRE.SQL
SPOOL log/GENRE.LOG;
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES
(GENRE_ID_SEQ.NEXTVAL,NULL,'Classical');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES
(GENRE_ID_SEQ.NEXTVAL,NULL,'Folk');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES
(GENRE_ID_SEQ.NEXTVAL,NULL,'Popular');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Popular'),'Rock');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Popular'),'Blues');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Popular'),'Contemporary');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Popular'),'Motown');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Popular'),'Reggae');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'Heavy Rock');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'Intellectual Rock');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'Grunge');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'American Soft Rock');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'Weird Rock');
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'More Weird Rock');
Appendix_A.fm Page 577 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
578
A.8
MUSISCD.SQL
INSERT INTO GENRE (GENRE_ID,STYLE_ID,GENRE) VALUES (GENRE_ID_SEQ.NEXTVAL,(SELECT
GENRE_ID FROM GENRE WHERE genre='Rock'),'Manic Rock');
COMMIT;
SPOOL OFF;
A.8 MUSISCD.SQL
SPOOL log/MUSICCD.LOG;
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='American Soft
Rock'),'Soak Up the Sun','28-FEB-2001',9.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='Manic
Rock'),'Complicated','15-DEC-2001',19.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='Weird
Rock'),'Here Is Gone Pt.1','11-JUN-2002',14.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='More Weird
Rock'),'Here Is Gone Pt.2','15-NOV-2001',9.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,PLAYING_TIME,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='American Soft
Rock'),'C''mon, C''mon','23-JAN-2002','56:32',19.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,PLAYING_TIME,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE
GENRE='Popular'),'Come Clean','09-JAN-02','48:03',14.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,PLAYING_TIME,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE
GENRE='Rock'),'Silver Side Up','14-JUL-2002','39:08',9.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,PLAYING_TIME,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE
GENRE='Contemporary'),'Ultimate Manilow','25-MAR-2002','77:43',19.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='Grunge'),'Mad
Season',14.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PLAYING_TIME,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='Blues'),'This
Way','58:42',9.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,PLAYING_TIME,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='Intellectual
Rock'),'The Best of Sheryl Crow','15-SEP-02','44:54',19.99);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE
GENRE='Classical'),'Requiem','16-MAY-90',7.98);
INSERT INTO MUSICCD (MUSICCD_ID,GENRE_ID,TITLE,PRESSED_DATE,LIST_PRICE)
VALUES (MUSICCD_ID_SEQ.NEXTVAL,(SELECT GENRE_ID FROM GENRE WHERE GENRE='Folk'),'Sweet
Baby James','25-OCT-90',10.99);
Appendix_A.fm Page 578 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
A.9
SONGANDTRACK.SQL 579
Appendix A
COMMIT;
SPOOL OFF;
A.9 SONGANDTRACK.SQL
SPOOL log/SONGANDTRACK.LOG;
SET ECHO OFF
Soak up the Sun by Sheryl Crow
INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE, PLAYING_TIME)
VALUES(SONG_ID_SEQ.NEXTVAL
,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Sheryl Crow')
,'Soak Up The Sun (Album Version)','11:20');
INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE, PLAYING_TIME)
VALUES(SONG_ID_SEQ.NEXTVAL
,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Sheryl Crow')
,'Soak Up The Sun (Sunsweep Radio Mix)','3:20');
INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME)
VALUES(SONG_ID_SEQ.NEXTVAL
,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Sheryl Crow')
,'Soak Up The Sun (Sunsweep Club Mix)','22:30');
INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE, PLAYING_TIME)
VALUES(SONG_ID_SEQ.NEXTVAL
,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Sheryl Crow')
,'Soak Up The Sun (Sunsweep Dub)','15:30');
COMMIT;
INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO)
VALUES ((SELECT MUSICCD_ID FROM MUSICCD WHERE TITLE='Soak Up the Sun')
,(SELECT SONG_ID FROM SONG
WHERE TITLE='Soak Up The Sun (Album Version)'),1);
INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO)
VALUES ((SELECT MUSICCD_ID FROM MUSICCD WHERE TITLE='Soak Up the Sun')
,(SELECT SONG_ID FROM SONG
WHERE TITLE='Soak Up The Sun (Sunsweep Radio Mix)'),2);
INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO)
VALUES ((SELECT MUSICCD_ID FROM MUSICCD WHERE TITLE='Soak Up the Sun')
,(SELECT SONG_ID FROM SONG
WHERE TITLE='Soak Up The Sun (Sunsweep Club Mix)'),3);
INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO)
VALUES ((SELECT MUSICCD_ID FROM MUSICCD WHERE TITLE='Soak Up the Sun')
,(SELECT SONG_ID FROM SONG
WHERE TITLE='Soak Up The Sun (Sunsweep Dub)'),4);
COMMIT;
Appendix_A.fm Page 579 Thursday, July 29, 2004 10:17 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
[...]... ARTIST_ID FROM ARTIST WHERE NAME='Angie Aparo')); Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark A.10 GUESTARTIST .SQL 599 INSERT INTO GUESTAPPEARANCE(COMMENT_TEXT,SONG_ID,GUESTARTIST_ID) VALUES('Very professional when meeting with the band' ,(SELECT SONG_ID FROM SONG WHERE TITLE='The Burn') ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Peter Stuart')); INSERT INTO GUESTAPPEARANCE(SONG_ID,GUESTARTIST_ID)... Doucette') ,(SELECT INSTRUMENT_ID FROM INSTRUMENT WHERE NAME='Acoustic Guitar')); Appendix A Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark 600 A.11 STUDIOTIME .SQL COMMIT; SPOOL OFF; A.11 STUDIOTIME .SQL SPOOL log/STUDIOTIME.LOG; INSERT INTO STUDIOTIME (STUDIOTIME_ID, ARTIST_ID, SESSION_DATE, DUE_DATE, MINUTES_USED) VALUES (STUDIOTIME_ID_SEQ.NEXTVAL,4,'08-MAY-00','07-JUN-00',120);... Sound','4:32'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) VALUES(SONG_ID_SEQ.NEXTVAL Appendix A Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark 582 A.9 SONGANDTRACK .SQL ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Sheryl Crow') ,'C''mon, C''mon','4:45'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID FROM ARTIST... VALUES(SONG_ID_SEQ.NEXTVAL,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Mozart'),'Requiem in D Minor: III Sequenz - No.1 Dies irae'); Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark A.9 SONGANDTRACK .SQL 583 INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE) VALUES(SONG_ID_SEQ.NEXTVAL,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Mozart'),'Requiem in D Minor: III Sequenz - No 2 - Tuba mirum'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE)... VALUES(SONG_ID_SEQ.NEXTVAL,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='James Taylor'),'Anywhere Like Heaven'); Appendix A Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark 584 A.9 SONGANDTRACK .SQL INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE) VALUES(SONG_ID_SEQ.NEXTVAL,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='James Taylor'),'Oh Baby, Don''t You Loose Your Lip on Me'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE)... CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO) VALUES ((SELECT MUSICCD_ID FROM MUSICCD WHERE TITLE='C''mon, C''mon') Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark A.9 SONGANDTRACK .SQL 585 ,(SELECT SONG_ID FROM SONG WHERE TITLE='Weather Channel'),13); COMMIT; Come Clean by Puddle of Mudd INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID... NAME='Puddle of Mudd') ,'Said','4:05'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) Appendix A Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark 586 A.9 SONGANDTRACK .SQL VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Puddle of Mudd') ,'It All Away','5:38'); COMMIT; INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO) VALUES ((SELECT MUSICCD_ID... VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Nickelback') ,'Never Again','4:20'); Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark A.9 SONGANDTRACK .SQL 587 INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Nickelback') ,'How You Remind Me','3:43'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME)... SONG WHERE TITLE='How You Remind Me'),2); INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO) Appendix A Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark 588 A.9 SONGANDTRACK .SQL VALUES ((SELECT MUSICCD_ID FROM MUSICCD WHERE TITLE='Silver Side Up') ,(SELECT SONG_ID FROM SONG WHERE TITLE='Woke Up This Morning'),3); INSERT INTO CDTRACK(MUSICCD_ID,SONG_ID,TRACK_SEQ_NO) VALUES... SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Barry Manilow') Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark A.9 SONGANDTRACK .SQL 589 ,'Bandstand Boogie','2:50'); INSERT INTO SONG(SONG_ID,ARTIST_ID,TITLE,PLAYING_TIME) VALUES(SONG_ID_SEQ.NEXTVAL ,(SELECT ARTIST_ID FROM ARTIST WHERE NAME='Barry Manilow') ,'Tryin'' To Get The Feeling .
570
A.3
SCHEMAOLTP .SQL
A.2 CREATEUSER .SQL
SPOOL log/CREATEUSER.LOG;
DROP USER MUSIC CASCADE;
CREATE USER. SALES_ID_SEQ;
CREATE SEQUENCE ARTIST_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE SEQUENCE SONG_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE