-- The J2EE Petstore Database create table category( categoryid VARCHAR(10) NOT NULL, name VARCHAR(25) NOT NULL, description VARCHAR(255) NOT NULL, imageurl VARCHAR(55), primary key (categoryid) ); CREATE TABLE product ( productid VARCHAR(10) NOT NULL, categoryid VARCHAR(10) NOT NULL, name VARCHAR(25) NOT NULL, description VARCHAR(255) NOT NULL, imageurl VARCHAR(55), primary key (productid), foreign key (categoryid) references category(categoryid) ); CREATE TABLE Address ( addressid VARCHAR(10) NOT NULL, street1 VARCHAR(55) NOT NULL, street2 VARCHAR(55), city VARCHAR(55) NOT NULL, state VARCHAR(25) NOT NULL, zip VARCHAR(5) NOT NULL, latitude DECIMAL(14,10) NOT NULL, longitude DECIMAL(14,10) NOT NULL, primary key (addressid) ); CREATE TABLE SellerContactInfo ( contactinfoid VARCHAR(10) NOT NULL, lastname VARCHAR(24) NOT NULL, firstname VARCHAR(24) NOT NULL, email VARCHAR(24) NOT NULL, primary key (contactinfoid) ); CREATE TABLE item ( itemid VARCHAR(10) NOT NULL, productid VARCHAR(10) NOT NULL, name VARCHAR(30) NOT NULL, description VARCHAR(500) NOT NULL, imageurl VARCHAR(55), imagethumburl VARCHAR(55), price DECIMAL(14,2) NOT NULL, address_addressid VARCHAR(10) NOT NULL, contactinfo_contactinfoid VARCHAR(10) NOT NULL, totalscore INTEGER NOT NULL, numberofvotes INTEGER NOT NULL, disabled INTEGER NOT NULL, primary key (itemid), foreign key (address_addressid) references Address(addressid), foreign key (productid) references product(productid), foreign key (contactinfo_contactinfoid) references SellerContactInfo(contactinfoid) ); CREATE TABLE id_gen ( gen_key VARCHAR(20) NOT NULL, gen_value INTEGER NOT NULL, primary key (gen_key) ); CREATE TABLE ziplocation ( zipcode INTEGER NOT NULL, city VARCHAR(30) NOT NULL, state VARCHAR(2) NOT NULL, primary key (zipcode) ); create table tag( tagid INTEGER NOT NULL, tag VARCHAR(30) NOT NULL, refcount INTEGER NOT NULL, primary key (tagid), unique(tag) ); create table tag_item( tagid INTEGER NOT NULL, itemid VARCHAR(10) NOT NULL, unique(tagid, itemid), foreign key (itemid) references item(itemid), foreign key (tagid) references tag(tagid) );