From the course: Advanced SQL for Data Scientists

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

SQL query functions

SQL query functions

- [Instructor] Now let's take a look at SQL functions. Now SQL functions are basically query language functions. So these are different from, say, writing a procedural code either in PL/pgSQL or in C or in Python. And so we're really writing in declarative language. So basically, we can execute an arbitrary list of SQL statements all at once in a single function. Now the thing to keep in mind about query language functions is that the last statement either has to be a select or the function has to be declared void. So if you're familiar with some procedural languages, you know, Java, C, sometimes, you can have a function which doesn't return anything, you declare it as void, which is basically means it's, you know, it's just a procedure, it has side effects, it doesn't return a value. Similar for query language functions, you can declare it as void. Also important to note that although functions are typically…

Contents