Create a simple SQL-language function.
Section: Views, Functions, Triggers, and Extensions
Create SQL function
sql
sql
CREATE FUNCTION public.user_email_domain(email text)
RETURNS text
LANGUAGE sql
AS $$
SELECT split_part(email, '@', 2);
$$;Explanation
See summary for usage details.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Views, Functions, Triggers, and Extensions