CS1103/Labs/Lab8/IsaacShoebottom_CS1103_Lab8/Prodecure.sql
2022-10-07 00:48:09 -03:00

15 lines
364 B
SQL

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