Suggest an editImprove this articleRefine the answer for “What is a function in SQL?”. 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 **a ready-made command or set of commands** that performs a specific action and **returns a result**; there are two kinds: **built-in** functions (already part of SQL - `COUNT()`, `SUM()`, `NOW()`, `UPPER()`) and **user-defined** functions (created by a developer to reuse logic). **Key point:** for example `CREATE FUNCTION get_full_name(...) RETURNS VARCHAR AS BEGIN RETURN CONCAT(first_name, ' ', last_name); END` can then be called as `SELECT get_full_name('Ivan', 'Petrov')`; functions help avoid repeating the same code.Shown above the full answer for quick recall.Answer (EN)ImageA **function in SQL** is **a ready-made command or set of commands** that performs a specific action and **returns a result**. Functions come in two kinds: 1. **Built-in**, already part of SQL. For example: - `COUNT()`, counts the number of rows; - `SUM()`, computes a total; - `NOW()`, returns the current time; - `UPPER()`, converts text to uppercase. 2. **User-defined**, created by a developer to reuse logic. ### Example ```sql CREATE FUNCTION get_full_name(first_name VARCHAR, last_name VARCHAR) RETURNS VARCHAR AS BEGIN RETURN CONCAT(first_name, ' ', last_name); END; ``` You can then call it like this: ```sql SELECT get_full_name('Ivan', 'Petrov'); ``` Functions help you **avoid repeating the same code** and make queries **shorter and clearer**.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.