Question: Need help creating a mysql procedure. Create a procedure to Delete the ClassStudent record for a given Class.Code and Student.FirstName (values will be provided as
Need help creating a mysql procedure.
Create a procedure to Delete the ClassStudent record for a given Class.Code and Student.FirstName (values will be provided as parameters.)
The class and firstname parameters will be varchars that match the table types.
Parameter names shall not have the same name as the table columns.
You may use JOINs or DECLARE variables to update the correct record.
The procedure run the procedure using the following instruction:
The procedure name must match this test.
Call DeleteClassStudent( 'COMM113','Hope');
Provided Code;
Create table Student(ID int auto_increment , FirstName varchar(30) NOT NULL , LastName varchar(50) NOT NULL , BirthDate date , primary key (id));
Create table Class(ID int auto_increment , Code varchar(10) UNIQUE , MaximumStudents int DEFAULT 10 , primary key (id));
Create table ClassStudent(ID int auto_increment , ClassID int NOT NULL , StudentID int NOT NULL , primary key (ID));
ALTER TABLE ClassStudent ADD SignUpDate datetime DEFAULT current_timestamp;
ALTER TABLE ClassStudent ADD FOREIGN KEY (ClassID) REFERENCES Class(ID);
ALTER TABLE ClassStudent ADD FOREIGN KEY (StudentID) REFERENCES Student(ID);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
