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.

2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by dharam_05
0

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?

0

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.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.