If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > ERD challenge

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-04, 18:01
snassimr snassimr is offline
Registered User
 
Join Date: Dec 2003
Posts: 6
ERD challenge

Hi , everybody !

I have confused with one situation need to model with ERD model :
Students study on course and each semestr get grade on it so i built three tables : student , course and student's course ther i will ave his grade.

But i have to accumulate some historical data : the average grade and accumulated by student credit point's . So how i can do it . Its derived data but it isnt derived from fields of the same row , its derived from rows of definite student (it may be 1 to 8 semestrs)
And i need to save overall average and credit points each semestr.

The more general problem how i save the historical and derived data in
database an how to model it in ERD.

How i can to solve it . Combine the student with one more table there i save all these data but calculating it from table of student's course ?

Any help ?

Thank in advance.
Reply With Quote
  #2 (permalink)  
Old 01-17-04, 18:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Code:
student
   \                                course
    \          semester              /
     \           /                  /
      \         /                  /
       \       /                  /
    studentsemester              /
            \                   /
             \                 /
              \               /
               \             /
                \           /
             studentsemestercourse
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-17-04, 20:07
snassimr snassimr is offline
Registered User
 
Join Date: Dec 2003
Posts: 6
Ok !

That was understood and where i will save current average and accumulated credit points of student ?
Reply With Quote
  #4 (permalink)  
Old 01-17-04, 20:13
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
overall average and credit points each semester go into studentsemester

overall average and credit points overall go into student
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-17-04, 20:26
snassimr snassimr is offline
Registered User
 
Join Date: Dec 2003
Posts: 6
Is it ok to put calculated overall average and credit points in student while these calclculated from anothe table of student semestr ?
Reply With Quote
  #6 (permalink)  
Old 01-17-04, 20:48
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i wouldn't, but you could

i would use views to produce totals grouped by semester and student

you said you had to save them, and of course you would save them in the appropriate record

but saving them means an update dependency -- if you add a new row to studentsemestercourse with credit points, then you have to re-calculate the average in studentsemester, and also student, whereas the averages in the view are correct at all times, since the view calculates them from the studentsemestercourse rows
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On