← Back to Upcase

Database Design between 3 tables


(charlieanna) #1

How do I set up the relation between 1. CalendarEntry 2. CalendarField 3. CalendarFieldValue?

where CalendarField consists of type names like “Teacher”,“Subject”,“Room”,“Weekday”,“Timing”.

CalendarFieldValue consists of all the possible values of above fields like Teacher1,Teacher2,Subject1,Subject2 etc with each having a foriegn id maybe to tell its Field.

Now CalendarEntry is each possible entry in the calender which has a reference to each CalendarFieldValue. For example CalendarValue1 can have Subject1,Teacher2,Weekday3 and Room1 as references.

Right now I am creating a dynamic table for each field and stuffing the values into that dynamic table.

Is this a right design?

Thanks


(Bruno Bruno) #2

Couldn’t understand what you need. But I’m afraid with what

dynamic table

means.


(charlieanna) #3

By dynamic table I meant a table created on the fly based on what the user enters. For example, he enters catalog for products and creates a number of products to put in that catalog.

I thought of creating a table called catalog which gets created after the user enters the name of this field. And then put the value of the products he creates inside that table.

This is what I meant by dynamic table but now it I have understood creating dynamic tables is a very bad idea.

Because another user may want to create a table of todos. And then put todos in that table.

I was creating an environment where I could create tables myself using a web interface and depending on the type of web project I could create tables from there.

I understand that not many mobile developers understand how ruby on rails work along with database storage. So thought I could use this myself along with giving this service to other developers.

Currently I am creating a table using sql create command and then using insert command to put in values into it.

But I am lost i trying to come up with associations between them without using rails.


(Jacob Evan Shreve) #4

Could you elaborate on what exactly it is you’re trying to do with your app?

It’s not obvious what a CalendarField is, or why CalendarFieldValue is a separate table.

You asked the question of “How do I link these tables together?”, when I think your question should have been more along the lines of “How do I represent these ideas as tables?