How better to design the database?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
5 views
doing this little site for several groups at the University. page with schedule, file archive, and other pleasures. the question arose in relation to the everyday schedule. on the page of each group will hang her schedule for tomorrow (optional — on any given day). at the moment, there are two tables, but they are not related to each other:

subjects (list of subjects)
subjId (unique number of the subject)
subjName (full name of subject)

groups (list of groups)
groupId (unique number of the subject)
subjName (name of group)

you need to map each group a list of items on Monday\\Tuesday\\etc...
knowledge of php and mysql at the primary level. therefore, I wanted to ask the gurus how better to design the database.
by | 5 views

6 Answers

0 like 0 dislike
well, like anything complicated, the table will be like this:
\r
timetable{
subjId int
groupId int
day int
startTime time
}
\r
schedule for the day for the group:
select * from timetable,subjects where timetable.subjId=subjects.subjId and groupId= & day= order by startTime;
by
0 like 0 dislike
But what about odd/even weeks? Well, wait no — then will be.
A number of audience? And the name of the teacher... Because of this extra information is enough to make the examination in to 4. :)
by
0 like 0 dislike
to make a one-to-many table groups.
by
0 like 0 dislike
Googling about ER-model (model of entity-relationship), just your case. Can more about normalization to check if the first approach will overcome the terms...
You can Google something more specific, for example, is (there is, however, aktsess, but you can look at the pictures with the model).
by
0 like 0 dislike
We do not touch because the group can be a few things. Make a table:
id (unique number)
id_group (group)
id_subjects (object)
id_day (day of week)
There may be other fields like lower/upper week.
Something to add to the group object are added to the table the necessary data. The sample is simple, select all the desired date in the right group. Or choose all for a specific date and make a schedule for all groups on this day of the week.
by
0 like 0 dislike
Better late than never :) eax.me/database-design
by

Related questions

0 like 0 dislike
2 answers
asked Jun 6, 2019 by xiiicool
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked May 20, 2019 by Narts
0 like 0 dislike
2 answers
asked May 21, 2019 by maksim92
0 like 0 dislike
2 answers
asked May 12, 2019 by lightsout93
110,608 questions
257,186 answers
0 comments
24,977 users