Skip to content
Permalink
464d2eb9ab
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
11 lines (9 sloc) 261 Bytes
DELIMITER //
CREATE OR REPLACE FUNCTION avgGrade (studentId INT) RETURNS DOUBLE
BEGIN
RETURN ( SELECT AVG(value)
FROM Grades
WHERE GRADES.studentId=studentId);
END //
DELIMITER ;
SELECT firstName, surname, avgGrade(studentId) FROM Students;