0

I have an entity that has nothing else than a surrogate key as a primary key. I use it as an element made of a group of other elements
For example :

TABLE SchoolClass (classNumber INTEGER PRIMARY KEY)

TABLE Students (SudentName TEXT PRIMARY KEY, studentClass INTEGER FOREIGN KEY)

Does it make sense ? The School Class entity does not store any information, but it's still used to regroup all the students in the same class.

2

This is fine as long as all you need is an index for the class, though it may be very difficult to troubleshoot exactly what is meant by a particular record in either future develompent or by a user for any reason at all.

If you want to be able to define anything about the class, say a name or other defining attribute, you'd just want to add this to the table as well.

For example:

TABLE SchoolClass (classNumber INTEGER PRIMARY KEY, classDescription TEXT)
0

I'm assuming this is K-6 not college. Otherwise the "one class per student" rule doesn't make sense.

A Class entity has no attributes? Like Grade( K-6), Teacher, Level (regular, learning disabled), room number, etc.

I think what you are really after is an intersection between Class and Students. A class is made up of many students. A student is registered with one class...per year. Or, depending on how you define Class, several classes (Art, Music, Drama, etc.). In any event, during their time at the school, each student will have many classes. So SchoolYear may be an attribute of the Class-Student relationship so would be in the intersection table.

That way you track all classes for each student over time.

At any rate, you are defining a relationship between two entities: Student and Class. And the answer is No, an entity without attributes doesn't make sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.