| | |
Whether my database design is right?
Please support our Database Design advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 22
Reputation:
Solved Threads: 0
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.
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.
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?
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
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
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
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- your ideas on database design??? (Database Design)
- Database design regarding two 'linking' tables (Database Design)
- Database Design for storing versions (Database Design)
- Database Design feedback (absolute beginner here :) (Database Design)
- Help with contact/mailing list database design... (Database Design)
- Database design - subtypes and instances of an entity (Database Design)
- Database Design - Supertypes and Subtypes (Database Design)
- Database Design Advice (MySQL)
Other Threads in the Database Design Forum
- Previous Thread: Simple Problem Relating 3 Small Tables
- Next Thread: how is this for a home accounting ER Diagram?
| Thread Tools | Search this Thread |






