Specifications

You can run an existing SQL file, such as one loaded from the CD-ROM, through MySQL by
typing
> mysql -h host -u bookorama books -p < bookorama.sql
Using file redirection is pretty handy for this because it means that you can edit your SQL in
the text editor of your choice before executing it.
LISTING 8.1 bookorama.sqlSQL to Create the Tables for Book-O-Rama
create table customers
( customerid int unsigned not null auto_increment primary key,
name char(30) not null,
address char(40) not null,
city char(20) not null
);
create table orders
( orderid int unsigned not null auto_increment primary key,
customerid int unsigned not null,
amount float(6,2),
date date not null
);
create table books
( isbn char(13) not null primary key,
author char(30),
title char(60),
price float(4,2)
);
create table order_items
( orderid int unsigned not null,
isbn char(13) not null,
quantity tinyint unsigned,
primary key (orderid, isbn)
);
create table book_reviews
(
isbn char(13) not null primary key,
review text
);
Creating Your Web Database
C
HAPTER 8
8
CREATING YOUR
WEB DATABASE
195
11 7842 CH08 3/6/01 3:38 PM Page 195