Suggest an editImprove this articleRefine the answer for “How do you create a function?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A function in SQL is created with the `CREATE FUNCTION` command: in general form - `CREATE FUNCTION function_name(parameters) RETURNS data_type AS BEGIN ... RETURN value; END`, after which the function can be used in queries, e.g. `SELECT get_full_name('Ivan', 'Petrov')`. **Key point:** the syntax can vary slightly between DBMSes (PostgreSQL, MySQL, SQL Server), but the logic is the same everywhere - a function **takes arguments**, **runs a computation**, and **returns a result**.Shown above the full answer for quick recall.Answer (EN)ImageA function in SQL is created with the `CREATE FUNCTION` command. General form: ```sql CREATE FUNCTION function_name(parameters) RETURNS data_type AS BEGIN -- function body RETURN value; END; ``` ### Example ```sql CREATE FUNCTION get_full_name(first_name VARCHAR(50), last_name VARCHAR(50)) RETURNS VARCHAR(100) AS BEGIN RETURN CONCAT(first_name, ' ', last_name); END; ``` Now you can use it in queries: ```sql SELECT get_full_name('Ivan', 'Petrov'); ``` Note: the syntax can vary slightly between DBMSes (e.g. PostgreSQL, MySQL, SQL Server), but the logic is the same everywhere - a function **takes arguments**, **runs a computation**, and **returns a result**.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.