-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `usp_show_users`(IN `user_id_low_param` INT, IN `user_id_high_param` INT, IN `birth_date_low_param` DATE, IN `birth_date_high_param` DATE, IN `school_ID_param` INT)
READS SQL DATA
BEGIN
/* Variables: */
/* SQL Statemens: */
select user_id, concat(last_name, ", ",first_name) as userName, date_of_birth as BirthDate
from user_profiles
where
school_instance_id = school_ID_param
AND ( (user_id >=user_id_low_param) and (user_id <=user_id_high_param) )
AND ( (date_of_birth >=birth_date_low_param) and (date_of_birth <=birth_date_high_param) )
order by
date_of_birth, user_id;
END