i would like to learn from you on designing the database schema:
ie. my problem is 1 activity has 1..* date_held
eg. activity name is
"see movie" has date_held on 1 Sep
"shopping" has date_held on 2 Sep , 5 Sep, 6 Sep
Method1
so my current database design is
---------------------------
Activity Table
---------------------------
id|name|date_held
1|see moive|20120901
2|shopping|20120902
3|shopping|20120905
4|shopping|20120906
You can see that shopping record is duplicated 3 time. I think it seem not good.
Method2
So I divide into 3 table
---------------------------
Activity Table
---------------------------
id|name
1|see moive
2|shopping
---------------------------
Date Table
---------------------------
id|date
1|Sep 1
2|Sep 2
3|Sep 5
4|Sep 6
---------------------------
Activity_Date Table
---------------------------
activity_id|date_id
1|1
2|2
2|3
2|4
But I think method 2 is very confused. Any one can give me a suggestion how to do table design on 1 activity match 1..* date_held?
Thanks!!
Hi Branko Dimitrijevic
after I think a few hour , i discover another method, i.e. use redis json format
{
"name":"shopping",
"date":[
"Sep1"
]
},
{
"name": "see movie",
"date":[
"Sep2","Sep5","Sep6"
]
}
It seem very easier~ :D
But let me think your suggestion..