19 lines
694 B
SQL
19 lines
694 B
SQL
DELIMITER \\
|
|
CREATE PROCEDURE AcceptStudent (
|
|
studentName VARCHAR(256),
|
|
emailAddress VARCHAR(256),
|
|
hsAverage FLOAT
|
|
)
|
|
BEGIN
|
|
IF (hsAverage < 0) OR (hsAverage > 100) THEN
|
|
SIGNAL SQLSTATE '45005'
|
|
SET MESSAGE_TEXT = 'High School average out of range.';
|
|
ELSEIF (hsAverage > 90) THEN
|
|
INSERT INTO Students(studentName, email, scholarship) VALUES (studentName, emailAddress, 1500);
|
|
ELSEIF (hsAverage >= 85) OR (hsAverage <= 90) THEN
|
|
INSERT INTO Students(studentName, email, scholarship) VALUES (studentName, emailAddress, 1000);
|
|
ELSE
|
|
INSERT INTO Students(studentName, email, scholarship) VALUES (studentName, emailAddress, 0);
|
|
END IF;
|
|
END\\
|
|
DELIMITER ; |