Click here to Skip to main content
15,916,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
i am trying to create the cgpa for students from my result table.
       i have the result table where i have the points and grade of each course of a student in a semister.
   now i am trying to calculate the gpa from the points of each semister and finally calculating the cgpa of the student

C#
now how can i calculate the gpa of each term of student.and then the cgpa..help please
thanks in advance..
gpa formula:
gpa=summation of ((credit*points) of each course) divided by total credit in a semister;


What I have tried:

i am trying to create the cgpa for students from my result table.
i have the following table:

create table result(
id number(2),
roll number(10),
c_id varchar(30),
marks number (6,2),
year number(3),
term number(3),
credit integer CHECK(credit>0 and credit<5),
points number(3,2),
grade varchar (4)
);

ALTER TABLE result ADD FOREIGN KEY (roll) REFERENCES student(roll)
ALTER TABLE result ADD FOREIGN KEY (c_id) REFERENCES courses(c_id)

i have inserted the result of two terms of a student.

insert into result (id,roll,c_id,marks,year,term,credit,points,grade) values (1,1307001,'cse 3103',200,2,1,3,4,'A+');
insert into result (id,roll,c_id,marks,year,term,credit,points,grade) values (2,1307001,'cse 3105',200,2,1,3,3.5,'A');
insert into result (id,roll,c_id,marks,year,term,credit,points,grade) values (3,1307001,'cse 3109',200,2,1,4,3.25,'B+');

insert into result (id,roll,c_id,marks,year,term,credit,points,grade) values (1,1307001,'cse 3103',200,3,1,4,3.5,'A');
insert into result (id,roll,c_id,marks,year,term,credit,points,grade) values (2,1307001,'cse 3103',200,3,1,3,3.25,'B+');
insert into result (id,roll,c_id,marks,year,term,credit,points,grade) values (3,1307001,'cse 3103',200,3,1,3,3.00,'B');

now how can i calculate the gpa of each term of student.and then the cgpa..help please
thanks in advance..
gpa formula:
gpa=summation of ((credit*points) of each course) divided by total credit in a semister;
Posted
Updated 28-Jul-16 20:51pm
v2

1 solution

I think your design is having some problem.
Please see the below code. U need to write something like this.

SELECT roll, c_id , (SUM(credit*Points))/(SUM(credit))
FROM result
Group BY roll, c_id
 
Share this answer
 
Comments
Member 12270086 31-Jul-16 9:44am    
will it give the result of 2nd year 1st term and 3rd year 1st term differently as i interred the results of them seperately.
Member 12270086 31-Jul-16 9:52am    
getting error:
total:=total+point;
*
ERROR at line 26:
ORA-06550: line 25, column 2:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 22, column 1:
PL/SQL: SQL Statement ignored
Member 12270086 31-Jul-16 9:54am    
my code link:http://paste.ubuntu.com/21635775/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900