Week03 Database Schemas
Week03 Database Schemas
User tables Store tables Product catalog Discounts Shipping Orders Other tables
2
Foreign key
Primary key
WebSphere Commerce
The examples which follow are based on IBM WebSphere Commerce, one of the most successful merchant server products. Combination of
IBM DB2 database IBM HTTP Server (Apache, really) WebSphere Java Application Server Lots of additional Java code, templates, tools and examples
Escape Clause
The examples that follow are from an extremely sophisticated merchant server product. You do not have to replicate these in your assignment!
But hopefully, they will stimulate your thinking and show you what a real-world server looks like.
Schema Overview
Have a separate table for addresses each shopper can have multiple addresses for personal, business, gifts, etc.
SHADDR
10
Multiple Stores
WebSphere Commerce can host multiple stores (merchants) on one server (mall) Each merchant has an entry in a MERCHANT table There can be a mall home page, which lists stores by category
Some stores could be in multiple categories (STRCGRY table)
11
12
13
14
Product templates
Typically display one product, with illustration(s), description, form fields for attributes (colour, size, etc.) and the all-important Add to Cart button
15
Similarly, if categories are a strict tree, customers will be frustrated if they take the wrong branch, so we need a many-many relationship
CGRYREL table
16
Product Information
Key product information goes in a single table
PRODUCT
Product Pricing
Products can have multiple prices
E.g. retail vs trade, club membership, etc. This is independent of any discounts that may be applied for quantity, order amount, etc.
Attributes
Size, colour, voltage, material,
Discounts
You may want to offer a discount on
Product quantity Total order value Promotional code
19
20
Discounts Tables
Shipping
Shipping costs vary according to product size and/or weight, as well as shipping method WCS supports shipping modes and shipping codes
21
22
Shipping Tables
Taking Orders
Almost forgot this one! Its not easy:
Suborders shipped to different addresses, with different shipping modes Various payment methods Wish lists, etc.
23
24
Orders
At the end of the process, the orders are in the ORDERS table SHOPPINGS is a table used for wishlists, repeat orders, etc.
Orders Tables
25
26
Other Stuff
We still havent dealt with
Multiple currency support Payment processing (credit cards, etc.) Page caching Advanced product recommendation functions Analytics Mapping commands to stores Multiple language support And a lot more!
See http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/nav/11_10_0
27 28
Summary
Real-world merchant server database schemas are complex
WCS had over 600 tables, last time I looked
Expect to spend quite a bit of time learning about any product you work with There are lots of complications in real-world e-commerce expect to have to refine any database schema you design from scratch
29