The main task sounds like this: "Make the function of combining the name and surname so that it matches the official style ("surname, firstname") f_name(firstname, secondname). If I correctly understood the task, then when entering ("First Name", "Last Name"), then at the output it should change their places -->("Last Name", "First Name").
I apologize if this sound clumsy, I study in another language. It should be simple, but I don’t know how to implement it.
This is what i have at this moment.
CREATE FUNCTION f_name ( Surname VARCHAR(50), Firstname VARCHAR(50)) RETURNS VARCHAR(200)
BEGIN
DECLARE official VARCHAR(200);
SET official = Surname + Firstname;
RETURN official
END;
SELECT f_name('Marko', 'Polo') as official ;