Today Only! Buy One, Get One Free!

BFG promotions work as follows: If a customer buys over a threshold amount of a given book or books from a given category, that customer receives a free gift. As with most sites, the gifts themselves aren't “normal” merchandise; you won't find the gift items by searching the categories.

In this example, two promotions will be available at launch. Buy Javabeans Unleashed and get a can of coffee, and buy any two J2ME books and get a PDA cover.

First you have to enter the two promotional items and the two promotions (see Listing 12.1).

Listing 12.1. Sample Data for the PROMOTION Table
 insert into PRODUCT (TITLE, PUB_DATE, ISBN, DESCRIPTION, PRICE) values ('Genuine Nagahyde PDA Carrying Case', '1998-12-22','PALMCASE','A ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.