The control statements of SQL stored procedures make SQL a computationally complete (that is, procedural) language. You can write your own UDFs and external stored procedures in C, C++, or Java to define what you want.
Procedural languages have functions that perform complex operations. The usual SQL statements do not support many functions. However, to reduce the reliance on ancillary application code, SQL supports standard scalar, aggregate, and ordered analytical functions.
You can also create scalar, aggregate, and table functions for specific needs.