views:

36

answers:

3

Hi, can some explain to me how the database design would look like for the following approach: let's say there are two tables 'toys' and 'wishlist'. Every wishlist has one toy, but 'toys' doesn't contain all the toys there are in the world. To prevent unhappy children lets add a row to toys called 'miscellaneous' so they can specify the toy they like in a text input, and that's where the problem begins. I don't know where to store this data.

A: 

Hmm... you might want to add a column to toys which will define if the toy is there by "design" or was added by a user. so you can still like a toy to a wish list, and separated toys between what was intentionally in the list and what is a miscellaneous...

tblTOYS:

TOYID, TOYNAME, SOURCEID

tblTOYSOURCES

SOURCEID, SOURCENAME

Dani
A: 

Let them rename toys from 'miscellaneous' to what they want. So you needn't to change database structure at all and children can see their favorite toy name instead of 'miscellaneous: battle robot'. It's more humane.

alygin
+2  A: 

I think you answered it yourself:

(assuming only one wishlist per customer)

wishlist_items
- customer_id
- toy_id

toys
- toy_id
- description
- type (permanent / customer-defined)

So when customers ask for an unknown toy, you simply write them into the toy list.

Will