CREATE FUNCTION count_car_model(@car_model_name VARCHAR(32)) RETURNS INT
AS
BEGIN
	DECLARE @cnt INT;

	SELECT @cnt = COUNT(m1.car_management_no)
	FROM nmrm_rent_car m1
	INNER JOIN nmrm_car_model m2
		ON (m1.car_model_id = m2.car_model_id)
	WHERE m2.car_model_name = @car_model_name;

	RETURN @cnt;
END;
