Initial Commit
This commit is contained in:
2
Labs/Lab7/AddScholorship.sql
Normal file
2
Labs/Lab7/AddScholorship.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE Students
|
||||
ADD scholarship INT DEFAULT 0;
|
BIN
Labs/Lab7/IsaacShoebottom_CS1103_Lab7.docx
Normal file
BIN
Labs/Lab7/IsaacShoebottom_CS1103_Lab7.docx
Normal file
Binary file not shown.
BIN
Labs/Lab7/IsaacShoebottom_CS1103_Lab7.pdf
Normal file
BIN
Labs/Lab7/IsaacShoebottom_CS1103_Lab7.pdf
Normal file
Binary file not shown.
BIN
Labs/Lab7/Lab7 - Stored Procedures.pdf
Normal file
BIN
Labs/Lab7/Lab7 - Stored Procedures.pdf
Normal file
Binary file not shown.
BIN
Labs/Lab7/Lab7Notes.pdf
Normal file
BIN
Labs/Lab7/Lab7Notes.pdf
Normal file
Binary file not shown.
19
Labs/Lab7/Procedure.sql
Normal file
19
Labs/Lab7/Procedure.sql
Normal file
@ -0,0 +1,19 @@
|
||||
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 ;
|
6
Labs/Lab7/Test Cases.sql
Normal file
6
Labs/Lab7/Test Cases.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CALL AcceptStudent('Adam Klitz', 'aklitz@gmail.com', 85);
|
||||
CALL AcceptStudent('Joanna King', 'j.king@gyahoo.com', 70);
|
||||
CALL AcceptStudent('Lanna Noman', 'nominal@outlook.com', 91);
|
||||
SELECT * FROM Students;
|
||||
CALL AcceptStudent('Ben Fry', 'benfry@yahoo.com', 140);
|
||||
|
Reference in New Issue
Block a user