question

AmjadAlmasri avatar image
AmjadAlmasri asked

Dynamic DB

if I want to create a DB like for a course that consists of dynamic number of parts, each part gas its own subjects, I want the user to creat the course record depends on the number of parts, so the course to be dynamic, am confused how my DB finally will end up, I am appreciating any help.
dynamic
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
It's primarily a mechanism of breaking down what are objects or concepts that you're going to store and what the relationships between them are. So you have a thing called a course and you have a thing called a subject and you have a thing called a student or user, right. That's three tables. Then, you have to have a way to relate them to each other. Probably there's going to be many courses that any subject can be a part of and many subjects that make up a course. So, the relationship there is many to many. That means you have to add a table to the relationship that goes back to the other two tables. There's more to it, but that is the basic concept. If you have a relationship that is one to many or many to one, then it's a direct relationship through a single foreign key. That's the basics of database design in a nutshell.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I appreciate all what did u say, but my question is goind around that I have only 1 course and this course sometime consists of (for example) 2 semesters and sometime more, so in my static table and static numbers its no problem but if the course will be changed, how is the mechanisim for maintaining the old data, do I have to make more fields in the same table and to fill them upon request, or if create the table each time as I need my DB will consist of so much tables for each course, this thing is really confuse me, I mean when my table will be dynamic how I will maintain the old data.
0 Likes 0 ·
The table can't really be dynamic. You can identify each course by year or by semester or by some other criteria. Then, you create a new course to meet the new criteria. the old course stays in place.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.