A P P E N D I X  B

CDShopCart Database Scripts

This appendix displays the following database scripts for the CDShopCart tutorial:

These scripts are also available as files within the CDShopCart application zip file, which you can download from the Sun ONE Studio 5 Developer Resources portal at:

http://forte.sun.com/ffj/documentation/tutorialsandexamples.html


Script for a PointBase Database

Use the following SQL script with a PointBase database.

drop table CD;
 
create table CD( 
	id		int,          
	cdtitle 	char(20),
	artist		char(20),
	country		char(20),
	price		number(8,2),  
	primary key(id));
 
insert into CD (id, cdtitle, artist, country, price) 
  values (1, 'Yuan','The Guo Brothers', 'China',14.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (2, 'Drums of Passion','Babatunde Olatunji', 'Nigeria',16.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (3, 'Kaira','Tounami Diabate', 'Mali',13.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (4, 'The Lion is Loose','Eliades Ochoa', 'Cuba',12.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (5, 'Dance the Devil Away','Outback', 'Australia',14.95);
 
commit;


Script for an Oracle Database

Use the following SQL script with an Oracle database.

/* Run with: sqlplus tutorial/tutorial@dbname @scriptname */
drop table CD;
 
create table CD( 
	id		int,          
	cdtitle		char(20),
	artist		char(20),
	country		char(20),
	price		number(8,2),  
	primary key(id));
grant all on CD to public;
 
insert into CD (id, cdtitle, artist, country, price) 
  values (1, 'Yuan','The Guo Brothers', 'China',14.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (2, 'Drums of Passion','Babatunde Olatunji', 'Nigeria',16.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (3, 'Kaira','Tounami Diabate', 'Mali',13.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (4, 'The Lion is Loose','Eliades Ochoa', 'Cuba',12.95);
insert into CD (id, cdtitle, artist, country, price) 
  values (5, 'Dance the Devil Away','Outback', 'Australia',14.95);
commit;


Script for a Microsoft SQLServer Database

Use the following SQL script with a Microsoft SQLServer database.

use cdcat
go
drop table CD
go
 
create table CD( 
	id		int,          
	cdtitle		varchar(20) null,
	artist		varchar(20) null,
	country		varchar(20) null,
	price		money null,  
PRIMARY KEY(id))
go
grant all on CD to public
go
 
insert into CD (id, cdtitle, artist, country, price) 
  values (1, 'Yuan','The Guo Brothers', 'China',14.95)
insert into CD (id, cdtitle, artist, country, price) 
  values (2, 'Drums of Passion','Babatunde Olatunji', 'Nigeria',16.95)
insert into CD (id, cdtitle, artist, country, price) 
  values (3, 'Kaira','Tounami Diabate', 'Mali',13.95)
insert into CD (id, cdtitle, artist, country, price) 
  values (4, 'The Lion is Loose','Eliades Ochoa', 'Cuba',12.95)
insert into CD (id, cdtitle, artist, country, price) 
  values (5, 'Dance the Devil Away','Outback', 'Australia',14.95)
go


Script for an IBM DB2 Database

Use the following SQL script with an IBM DB2 database.

drop table CD
 
create table CD(	
	id		int not null primary key ,
	cdtitle		char(20),
	artist		char(20),
	country		char(20),
	price		num(8,2))
 
insert into CD (id, cdtitle, artist, country, price)
   values (1, 'Yuan','The Guo Brothers', 'China',14.95)
insert into CD (id, cdtitle, artist, country, price)
   values (2, 'Drums of Passion','Babatunde Olatunji', 'Nigeria',16.95)
insert into CD (id, cdtitle, artist, country, price)
   values (3, 'Kaira','Tounami Diabate', 'Mali',13.95)
insert into CD (id, cdtitle, artist, country, price)
   values (4, 'The Lion is Loose','Eliades Ochoa', 'Cuba',12.95)
insert into CD (id, cdtitle, artist, country, price)
   values (5, 'Dance the Devil Away','Outback', 'Australia',14.95)