November 4, 2016 at 8:30 am
Hello ,
I need an advice. let me describe.
I have Main table with this structure:
id
id_creator
id_approver
id_teacher
Next 3 tables(creator, apporover, teacher) has the same list of users. I'm thinking to create just one table for all.
Reason is that I want to send emails to different users(creator,approver,teacher). I created also table emails with id for all of tables
with structure(id, email)Is it good idea to go this way?
Sometimes I will need add user, and I would like to avoid updating all these tables.
Thank you for every comment.
November 4, 2016 at 8:38 am
Sounds like you're on the right track.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
November 4, 2016 at 8:50 am
Alvin Ramard (11/4/2016)
Sounds like you're on the right track.
okay but what is better? to have 3 tables separated or create one table... but, than I must create 3 relationship from one table to main table, is it okay?
November 4, 2016 at 8:54 am
peter478 (11/4/2016)
Alvin Ramard (11/4/2016)
Sounds like you're on the right track.okay but what is better? to have 3 tables separated or create one table... but, than I must create 3 relationship from one table to main table, is it okay?
I would create one user table, with 3 relationships.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
November 7, 2016 at 6:18 am
Quick thought, if you are storing exactly the same information for all "person types" then a single person table could work.
😎
+------------+ +-------------+
| TBL_PERSON | | TBL_MAIN |
+------------+ +-------------+
| ID_PERSON |-+--, | id |
| (DETAIL) | |--------------+<| id_creator |
+------------+ |--------------+<| id_approver |
'--------------+<| id_teacher |
+-------------+
I would though suggest another pattern which allows for different information stored for each person type in addition to common person attributes
Common for all Person type specific Main table
person data
+------------+ +-------------+ +-------------+
| TBL_PERSON | | TBL_CREATOR | | TBL_MAIN |
+------------+ +-------------+ +-------------+
| ID_PERSON |-+--, | ID_CREATOR |-+-----, | id |
| (DETAIL) | |----------+<| ID_PERSON | '------+<| id_creator |
+------------+ | | (DETAIL) | ,--------+<| id_approver |
| +-------------+ | ,------+<| id_teacher |
| | | +-------------+
| +--------------+ | |
| | TBL_APPROVER | | |
| +--------------+ | |
| | ID_APPROVER |-+--' |
|----------+<| ID_PERSON | |
| | (DETAIL) | |
| +--------------+ |
| |
| +-------------+ |
| | TBL_TEACHER | |
| +-------------+ |
| | ID_TEACHER |-+-----'
'----------+<| ID_PERSON |
| (DETAIL) |
+-------------+
November 8, 2016 at 4:10 pm
Hi, thank you for your thoughts, the second diagram is more interesting for me.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply