943,715 Members | Top Members by Rank

Ad:
Aug 7th, 2008
0

Whether my database design is right?

Expand Post »
I have to create database of student having different subjects and marks in respective subjects.

Now many students will many subjects so there is many to many relationship.

My database design:
Table 1:

Student table
(PK)Stud_id, Stud_name

Table 2:

Subject table
(FK)Stud_id, Sub_id, Sub_name, Marks.

Table 3:

Stud_Sub table
Stud_id, Sub_id

1) is this design is right or wrong?

2) Secondly i want to find name of the student who scored second highest marks.
Last edited by dharam_05; Aug 7th, 2008 at 3:45 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dharam_05 is offline Offline
22 posts
since Aug 2008
Aug 7th, 2008
-1

Re: Whether my database design is right?

Why don't you have only (PK)Sub_id and Sub_name in Subject table
and
(FK)Stud_id, (FK)Sub_id, Marks in Stud_Sub table?
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 7th, 2008
0

Re: Whether my database design is right?

Ok so there is no need of stud_id in sec table?
other than that thing are ok in database?
But i want to calculate sec highest marks of the student.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dharam_05 is offline Offline
22 posts
since Aug 2008
Aug 7th, 2008
-1

Re: Whether my database design is right?

Click to Expand / Collapse  Quote originally posted by dharam_05 ...
But i want to calculate sec highest marks of the student.
You need to run query that will look up all the students with their marks of given subject. Sort them descending order and ask for second of them. So try to come with some query and if doesn't work out post it and we may have go on it.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 871
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 7th, 2008
0

Re: Whether my database design is right?

Ok i give a try thanks , will get back to you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dharam_05 is offline Offline
22 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Database Design Forum Timeline: Simple Problem Relating 3 Small Tables
Next Thread in Database Design Forum Timeline: how is this for a home accounting ER Diagram?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC