Whether my database design is right?

Thread Solved

Join Date: Aug 2008
Posts: 22
Reputation: dharam_05 is an unknown quantity at this point 
Solved Threads: 0
dharam_05 dharam_05 is offline Offline
Newbie Poster

Whether my database design is right?

 
0
  #1
Aug 7th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,192
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Whether my database design is right?

 
-1
  #2
Aug 7th, 2008
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?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 22
Reputation: dharam_05 is an unknown quantity at this point 
Solved Threads: 0
dharam_05 dharam_05 is offline Offline
Newbie Poster

Re: Whether my database design is right?

 
0
  #3
Aug 7th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,192
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 485
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Whether my database design is right?

 
-1
  #4
Aug 7th, 2008
Originally Posted by dharam_05 View Post
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.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 22
Reputation: dharam_05 is an unknown quantity at this point 
Solved Threads: 0
dharam_05 dharam_05 is offline Offline
Newbie Poster

Re: Whether my database design is right?

 
0
  #5
Aug 7th, 2008
Ok i give a try thanks , will get back to you.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC