I need to put something in my database so i can check on students which courses they have, but which method is better
{
Table1
Rows:
studentID,
lessonID,
hasPerfectCourse,
courseID,
}
or
{
Table1
Rows:
studentID,
lessonID
Table2
Rows:
studentID,
hasPerfectCourse,
courseID
}
and they both do the same thing, but I would like to know which one is better for performance
EDIT
so if the student passed all his exams he’ll have a perfectcourse and will just get a courseid so it’s possible to get all the lessons with that courseid
and if the student doesn’t have a perfectcourse, for example he/she still have lessons from the first year while he/she is in the third year with also some lessons from the second year
hope I made myself understandable because i’m not the best person to explain something 😀
/EDIT
Greetz,
Haroun
The concept of less tables => less joins => better performance leads to the “god table” anti-pattern.
My opinion is that you aim for 5th normal form in design, and then de-normalise where appropriate based on peformance and architectural considerations.
In short, does holding the data in one table ever lead to redundant duplication of data across rows (data, not keys), or combine properties of disparate/discrete entities into a single table?
If you’re really concerned about “getting it right”, read up on the web about Normalisation 🙂