tags:

views:

79

answers:

2

I want a table structure which can store the details of the student like the below format.

If the student is in 10 th standard -> I need his aggregate % from 1st standard to 9th standard. 5 th standard -> I need his aggregate % from 1st standard to 4th standard. 1 st standard -> No aggregate % has to be displayed.

And the most important thing is ' we need to use only one table'. Please form a table structure with no redundant values.

Any ideas will be greatly appreciated......

No friends this is not a home work. This is asked in Oracle interview, conducted in Hyderabad day before yesterday '24th July, 2010',. He asked me the table structure.

He even did not asked me the query. He asked me how I will design the table. Please advice me.

A: 
id | name | grade | aggregate

This would do the trick, id is your primary key, name is students first last name, grade is what grade he is in and aggregate is aggregate % based on the grade.

Fro example some rows might be:
10 | Bill Cosby | 10 | 90
11 | Jerry Seinfeld | 4 | 60

Bill Cosby would have aggregate percent of 90 in grades 1-9, and jerry would have 60 in grades 1-3. In this case it is one table and boils down to you managing the rule of aggregation for this table, since it has to be one table.

Chris
Thanks for your prompt response. But the thing is we don't need the aggregate of all the years, but for every year. Like -> The roll no of student, his 1st standard aggregate, 2nd standard aggregate, 3rd standard aggregate .......... so on. So when a student is selected we will be able to see his total academic progress. I told them two answers1. creating 10 columns for every standard. This was put as wrong because of unnecessary columns. 2. creating 10 rows for every standard. Again this is wrong coz the roll no will not be primary key.I think u got the point
Thanks for your prompt response. But the thing is we don't need the aggregate of all the years, but for every year. Like -> The roll no of student, his 1st standard aggregate, 2nd standard aggregate, 3rd standard aggregate .......... so on. So when a student is selected we will be able to see his total academic progress. I told them two answers 1. creating 10 columns for every standard. This was put as wrong because of unnecessary columns. 2. creating 10 rows for every standard. Again this is wrong coz the roll no will not be primary key. I think u got the point
A: 

Dear user402128, I was wondering if you already have a solution for your problem. Another problem arrises if you ask that for one student you cannot tell his year started with 1; can it? What if the student started at year 2 and is in year 5, your aggregate would be from 2 till 4, wouldn't it? So you need a first year. like yearstart? what if the student was out for one year, so you would have a gap of x-years. So the aggregate could be 2 till 5 -x. So you would have a something like: yearsnotspend or free; the currentYear would be the year the student now is attending.

student | currentYear | startYear | yearGap

You can now calculate the aggregate ...

Hope it helps or if I am wrong, please provide me the correct way :-)

DannyS