YUSUF ATES
asked on
sql, function
DELIMITER $
CREATE FUNCTION MAXSCOREID(START_STUDENT_I D INT, END_STUDENT_ID INT)
RETURNS INT
BEGIN
DECLARE STUDENT_ID INT;
BEGIN
SELECT MAX(SCORE) INTO STUDENT_ID
FROM STUDENT ST, SCORE S
WHERE ST.STUDENT_ID = S.STUDENT_ID
AND ST.STUDENT_ID BETWEEN 1 AND 10;
END;
RETURN student_id;
END$
DELIMITER ;
Hi. With the function above, I get the higher score but I want to get the student`s id who has the max score. Any help, please?
CREATE FUNCTION MAXSCOREID(START_STUDENT_I
RETURNS INT
BEGIN
DECLARE STUDENT_ID INT;
BEGIN
SELECT MAX(SCORE) INTO STUDENT_ID
FROM STUDENT ST, SCORE S
WHERE ST.STUDENT_ID = S.STUDENT_ID
AND ST.STUDENT_ID BETWEEN 1 AND 10;
END;
RETURN student_id;
END$
DELIMITER ;
Hi. With the function above, I get the higher score but I want to get the student`s id who has the max score. Any help, please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER