Hi guys, I am studying databases and i know create tables, insert data... beginner's stuff...

Now I'm learning to create functions and one of the problems that arise I can not get it out.
Could you help me?

PROBLEM:
---------------------------------------------------------------------------------------------------------

I have a table "teacher" with several columns, one of which is "locality" and other column "name".

The function must return the names of teachers whose locality = 'Badalona'

The query in code would be:

'SELECT name
FROM teacher
WHERE locality = 'Badalona';

Someone knows how to make query into function?

I tried to do it, but my code does not work.

ATTEMPT CODE
--------------------------------------------------------------------------------------------------------

CREATE FUNCTION functionName()
RETURNS AS

'DECLARE

BEGIN

EXECUTE

'SELECT name
FROM teacher
WHERE locality = 'Badalona';

END;'

LANGUAGE plpgsql;

-----------------------------------------------------------------------------------------

I know missing some parameters in the code, but I dont know what...

Someone could help me

Thank you very much in advance and greetings to the entire community