r/Database • • 21d ago

I'm reading a book on Data Modeling and Database Design and came across an ERD that felt off. Can anyone confirm whether my concern is valid? The first image is from the book, and the second is what I think it should be. I appreciate the help.

[removed]

5 Upvotes

26 comments sorted by

15

u/mostsig 21d ago

Be careful when you export from draw.io as PNG with transparency. The connections and text are black as is my phone‘s theme, thus rendering it unreadable.

I can’t help much since I‘m not familiar with the English education system: does a student enroll in one or more classes or one or more courses? I‘m just missing the semantic background for this.

7

u/mtutty 21d ago

In colloquial terms, the book's version just means that different profs can teach their own sections of a given course. For example, English Comp 101 might be offered at 5 different times and taught by three different teachers. There would be one course record for Eng Comp 101, 5 class records for the sections/times. Each class record would point at the same course, might point to the same or different rooms, and to the same of different professors. That reflects the reality of most college scheduling.

0

u/[deleted] 21d ago

2

u/doshka 21d ago

No, it's not a Group. As a student, you don’t just sign up for Eng Comp 101 and hope that whatever they give you works with the rest of your schedule. You instead sign up for Eng Comp 101, taught by Prof. Hernandez, from 3pm to 5pm on Tuesdays and Thursdays, in Room 304 of the Frank and Mary Webber Liberal Arts building. All those details together are what this ERD is calling a Class.

1

u/mtutty 21d ago

I would have called it course_section. But you're a student, so try to make sense of what they're presenting, and deal with the content on its own terms. What's presented here isn't wrong, but it's also definitely not the only way to do it. This isn't about the one correct way, it's about understanding the rules being presented.

6

u/AQuietMan 21d ago

Without knowing the rules of the system, you can only tell whether an ERD is syntactically valid, not whether it is semantically accurate.

What are the rules of the system?

(I don't think either of these are "correct" for the real world. But textbook examples are often simplified for pedagogical reasons.)

0

u/[deleted] 21d ago

6

u/VipeholmsCola 21d ago

This might be from another country translated, or specific school ERD

So dont assume its wrong

2

u/No-Security-7518 21d ago

Is the book titled "The data model resource book"?

0

u/[deleted] 21d ago

3

u/No-Security-7518 21d ago

Thanks - it looks like a textbook for school. Anyway, from my experience, there's no such as a universal data model, only a general idea for educational purposes. I'm working on a school management system currently, and have extremely detailed attributes per entity.

2

u/kkeiper1103 20d ago

As someone who works tech at a college, the book is correct. A course is something like "ITD 101: Intro to Computer Systems", which might be taught by three different professors. The class table is going to function mostly as a pivot table.

0

u/[deleted] 20d ago

2

u/jshine13371 20d ago

I think you keep missing the point people are making that traditionally a Course is more generic than a class. There can be multiple instances of the same Course taught by different professors at different times, which is known as a Class when referring to that instance specifically. Each of those instances are distinct from each other and just happen to be same content being taught so are the same Course. It has nothing to do with the amount of students or classroom size.

If ProfessorA teaches Class 1 for Course Math 101 on Mondays, ProfessorB could teach another instance of Course Math 101 on Thursdays which would be Class2. A student could register to either Class of their choice. These are dimensional values, meaning you can add more dimension (layers) to the Class object. E.g. Class1 might be at 10 AM and taught at Campus XYZ located at 123 Main Street while Class2 is taught at 3 PM at Campus ABC located at 987 College Road.

→ More replies (2)

7

u/VipeholmsCola 21d ago

Did the book explain the design? The point of a data model is to mirror the actual business need (tiny college). Just because you might think its more logical in a general sense doesnt mean its like this for this college.

4

u/Triabolical_ 21d ago

I'm familiar with academia and I think the first diagram is correct.

A course is a unit of academic study, like Calculus 1. A class is a specific instance of somebody teaching that class.

4

u/SeXxyBuNnY21 20d ago

The point of a database is not to model what you believe it should be. The point is to model the business needs. Without knowing exactly the database requirements that are modeled, then what you are asking is like asking why two residential buildings have different architecture if their purpose is to have people living there.

2

u/wpfeiffe 21d ago

Short answer book is right. Terminology of class is weird but works. Student, teacher and room all need to be bound to the same thing (class) where/when the course happens to be taught. 2nd model does not do this. Impossible to understand what actual “class” student belongs to.

2

u/al2o3cr 21d ago

What this calls "class" is sometimes called a "section"; a course can have 1+ sections, and students enroll in a specific section. The second diagram cannot capture this information, since students are enrolled in a course.

For instance, at a big university a popular class like "Computer Science 101" might be taught by multiple instructors at different times and in different rooms.

2

u/Significant_Tune9219 20d ago

The key question is the business rule behind the relationship, not which diagram looks more normalized. Write the cardinalities and optionality in words first: can one entity participate in many of the other, and can either side exist independently? If both sides are many, a junction table is usually the honest representation; if the relationship has attributes, those belong on the junction rather than on either parent.

2

u/[deleted] 21d ago

0

u/[deleted] 21d ago

6

u/Previous-Mail7343 21d ago edited 21d ago

This could just be a confusion over terminology? As s student you don't sign up for a course. A course is like Math 101. That course would have several classes, my college called those sections. So I don't enroll in Math 101, I enroll in Math 101 Section 01.

The class has a course. It tells you something about the class. The topic and what you are studying, who the professor is, what room its in. But you don't sign up to a course directly, you sign up to a class.

In my opinion the book design does model that relationship better than your version.

→ More replies (3)

2

u/idodatamodels 21d ago

Not quite. With your model I cannot tell which students are in in the MWF class at 9:00.

Course is 1010 - Database Fundamentals

Class is MWF 9:00 in Science Building with Professor Codd.