Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
1. Introduction
Syntax of PL/pgSQL
Function parameters
Handling exceptions


Welcome! In this part of our course, we'll explain the basics of creating functions in Postgres.

We will cover the basics of PL/pgSQL syntax (variables, constants, assignments, loops, exceptions, etc.), function parameters, and function overloading.

Before we dig into the details, let's review the database tables we are going to work with. We'll be working with a small company's database. Our database tables store data related to departments, employees, and salaries.

The first table we are going to review is named department.


Select all columns from the department table, which contains just the following two attributes related to a department object:

  • department_id
  • name