CS1103/Labs/Lab8/IsaacShoebottom_CS1103_Lab8/Prodecure.sql

15 lines
364 B
MySQL
Raw Normal View History

2022-10-07 00:48:09 -03:00
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