Monday, April 4, 2022

MySql -Stored Procedure some more examples


Create procedure studentproc()
Begin
select * from student;
select count(*) from student;
End &&
DELIMITER ;

DELIMITER &&
Create procedure studentdetail(IN id1 int )
Begin
select * from student where id=id1;

End &&
DELIMITER ;

DELIMITER &&
Create procedure studenttotalmarks(OUT totalmarks int )
Begin
select sum(marks) into totalmarks  from student ;

End &&
DELIMITER ;


DELIMITER &&
Create procedure studentgrade(IN grade1 varchar(1),OUT totalmarks int )
Begin
select sum(marks) into totalmarks  from student where Grade=grade1;

End &&

DELIMITER ; 

0 comments:

Post a Comment