论坛首页 入门技术论坛

请问下面这题怎样写出最优设计方法?

浏览 1659 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-07-12  
Exercise 2: Product Catalog Search Indexing

2a). Design and implement, in MySQL, a database that implements the entity-relationship (ER) diagram for a Product Catalog Tree.  Manually input the following sample data into your MySQL database instance.

Sample Data: Product Catalog Tree

Catalog “A” contains
Category “A1” contains
Products P1 ($1.99), P2 ($2.99), P3 ($3.99), P4 ($4.99)
Category “A2” contains
Category “A21” contains
Products P5 ($5.99), P6 ($6.99)
Category “A22” contains
Products P7 ($7.99), P8 ($8.99)

Catalog “B” contains
Category “B1” contains
Category “B11” contains
Products P1 ($11.99), P2 ($12.99)
Category “B12” contains
Products P3 ($13.99), P4 ($14.99)
Category “B2”
Products P5 ($15.99), P6 ($16.99), P7 ($17.99), P8 ($18.99)

Hints:
• This is NOT a Binary Tree.  A Category may contain more than two (2) Child-Categories, and/or more than two (2) Child-Products.  For example, Category A1 contains four (4) Products: P1, P2, P3 and P4.
• Prices are “attached to” Category – Product combinations.  As such, Prices are Category specific.  For example, under Catalog A -> Category A1, Product P1 is $1.99.  Under Catalog B -> Category B1 -> Category B11, Product P1 is $11.99.
• Product may show up in different Catalogs and Categories.  For example, Product P1 shows up under Catalog A -> Category A1, but also shows up under Catalog B -> Category B1 -> Category B11.


2b). Design and implement, in Java and JSP, a MySQL database application that performs the following functionality:

• Retrieve and store a Product Catalog Tree in memory
• Display the Product Catalog Tree in a JSP page
• Generate Product Search Index Table from the Product Catalog Tree
• Display the Product Search Index Table in a JSP page

Sample Input: (Same as the Sample Data in #2a)

Catalog “A” contains
Category “A1” contains
Products P1 ($1.99), P2 ($2.99), P3 ($3.99), P4 ($4.99)
Category “A2” contains
Category “A21” contains
Products P5 ($5.99), P6 ($6.99)
Category “A22” contains
Products P7 ($7.99), P8 ($8.99)

Catalog “B” contains
Category “B1” contains
Category “B11” contains
Products P1 ($11.99), P2 ($12.99)
Category “B12” contains
Products P3 ($13.99), P4 ($14.99)
Category “B2”
Products P5 ($15.99), P6 ($16.99), P7 ($17.99), P8 ($18.99)

Sample Output: Product Search Index Table

Catalog / Category Path Product Name Price
A -> A1 P1 $1.99
A -> A1 P2 $2.99
A -> A1 P3 $3.99
A -> A1 P4 $4.99
A -> A1 -> A21 P5 $5.99
A -> A1 -> A21 P6 $6.99
A -> A2 -> A22 P7 $7.99
A -> A2 -> A22 P8 $8.99
B -> B1 -> B11 P1 $11.99
B -> B1 -> B11 P2 $12.99
B -> B1 -> B12 P3 $13.99
B -> B1 -> B12 P4 $14.99
B -> B2 P5 $15.99
B -> B2 P6 $16.99
B -> B2 P7 $17.99
B -> B2 P8 $18.99
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics