Re: Database design for calendar
| From: | Rui Cunha | Date: | Sat, 17 Jul 2004 07:26:05 +0000 |
| Subject: | Re: Database design for calendar | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35332@lists.php.net to get a copy of this message | ||
Hi Arnout,
i'd choose your first suggestion.
Using the calendar table (you can use the date field as Primary Key) and
the other tables (birthdays,testpapers,....) where you could use the date field as Foreign Key.
With simple 1-N relationships you can solve the prob.
hope it helps.
Rui Cunha
Arnout Boks writes:
Hi, I'm currently working on a php-based community website for my school class. Part of that website is a calendar function that includes the dates of all testpapers, birthdays, school parties and so on... Of course, a testpaper has got other properties than a birthday, so they should go into different tables with different fields. They have to be mixed when showing the calendar overview, but the detail pages should be different for each type of calendar entry. After some thinking, I came up with two different solutions:I: Make one table 'calendar', which contains all the common fields(likedate, time etc.). Make tables 'birthdays', 'testpapers'... and link each record in them to a record in the calendar with a 'calendar_id'.II: Create only tables 'birthdays', 'testpapers'.... and combine them with a UNION statement.Could someone give his/her opinion about what he/she thinks to be the best solution. (I use MySQL, if you need to know.) Thanks in advance, Arnout