15 lines
364 B
MySQL
15 lines
364 B
MySQL
|
CREATE PROCEDURE `studentTranscript`(
|
||
|
IN `ID` INT
|
||
|
)
|
||
|
BEGIN
|
||
|
IF EXISTS(SELECT 1 from Students where studentID = ID) THEN
|
||
|
SELECT courseName, letterGrade
|
||
|
FROM Enrollments
|
||
|
NATURAL JOIN Courses
|
||
|
NATURAL JOIN Students
|
||
|
WHERE studentID = ID;
|
||
|
ELSE
|
||
|
SIGNAL SQLSTATE '45006'
|
||
|
SET MESSAGE_TEXT = 'Student ID does not exist in system.';
|
||
|
END IF;
|
||
|
END
|