Junction Tables

R

.:RoKsTaR:.

I'm just curious if it makes sense to use junction tables in this instance:

student - studentID, studentfirst, studentlast, gender, age (adult, teen, or
child), lessonday, status (current or retired)

address - addressID, address, city, province, postalcode

phone- phoneid, phonenum, extension, phlocation

email - emailid email, emailLocation

gaurdian – gaurdianid, gaurdianfirst, gaurdianlast, relationship


studentaddress - studentID, addressID
studentguardian - studentID, guardianID
GuardianAddress - guardianID, addressid
Studentphone - studentID, PhoneID
Guardianphone - guardianID, PhoneID

Notes on this table:
I'm a music teacher who teaches an average of 50 students at a time. I'm
trying to build a database track contact info, invoice students, and track
attendance. I'm starting off with the contact portion of the database and
once that is done I'll move on to the rest.

-Adult students don't have guardians
-Students with divorced parents may have 2 addresses and 4 Guardians. Not
many students in this situation
-Most parents have 2 emails and phone numbers
-Some young students may provide their own phone and email

That's it, thanks in advance
 
S

Stefan Hoffmann

hi,

I'm just curious if it makes sense to use junction tables in this instance:

student - studentID, studentfirst, studentlast, gender, age (adult, teen, or
child), lessonday, status (current or retired)
address - addressID, address, city, province, postalcode
phone- phoneid, phonenum, extension, phlocation
email - emailid email, emailLocation
gaurdian – gaurdianid, gaurdianfirst, gaurdianlast, relationship

studentaddress - studentID, addressID
studentguardian - studentID, guardianID
GuardianAddress - guardianID, addressid
Studentphone - studentID, PhoneID
Guardianphone - guardianID, PhoneID

In short: Yes, normally it does.

But you can "simplify" it a little bit more:

Guardians and Students are People ;)

So I would generalize it:

People: ID, FirstName, LastName
Address: ID, address, city, province, postalcode
Email: ID, email, emailLocation
Phone: ID, phonenum, extension, phlocation

PeopleAdress: idPeople, idAddress
PeopleEmail: idPeople, idEmail
PeoplePhone: idPeople, idPhone

Student: ID, idPeople, LessonDay, Gender, Age, Status
Guardian: ID, idPeople, Relationship

StudentGuardian: ID, studentID, guardianID


mfG
--> stefan <--
 
R

.:RoKsTaR:.

Ok, I see what's going on. You're using the student/gaurdian table to join
people together from the separate student and guardian tables. I can follow
that, thanks!
 
J

Jeff Boyce

I'll add another observation ...

Your field [age] is guaranteed to require maintenance (i.e., "fixing").
Even if you don't use age = years, but the categories you mentioned, sooner
or later kids grow up. How frequently do you plan to revisit [age] and
update it? What criteria will you use?

What happens if someone else takes over the maintenance of this application?
Do they use the same criteria? Do they even know they need to maintain (AKA
"fix") that field? How frequently?

As an alternative, you could enter Date of Birth ... and use a function to
"calculate" age, or age category, or ...

That way, you NEVER need to maintain/fix that field's values!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
R

.:RoKsTaR:.

That's a really cool idea, great thinking! How's that done?

I'll be the only one using this database, so I'm not to worried. However,
anything to make it work better is great :)
 
J

Jeff Boyce

Unfortunately (and it may be just me), when I have to go back later (even a
few months later) and figure out what I was doing (and thinking?!?) in an
application, I AM worried. I try to leave breadcrumbs and simplify as much
as possible ... because I MAY be the only one that has to use the db! <g>

If you add a date/time field to your table and call it something like
[DateOfBirth] (or, if you have a really really good memory, [DOB]), you
would enter the individual's birthday.

Then, in a query, you could call a function (a procedure you write that
returns a value) to derive the age category your original post mentioned.
To determine something like "age", there are a lot of examples of code you
can find by searching on-line for "calculating age from birthdate" and "MS
Access".

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top