Transactions and Error Handling in PostgreSQL

Ensure data consistency by learning how to use transactions and handle errors in concurrent environments.
Start Course for Free
4 Hours15 Videos49 Exercises
3950 XP

Create Your Free Account

By continuing you accept the Terms of Use and Privacy Policy. You also accept that you are aware that your data will be stored outside of the EU and that you are above the age of 16.

Loved by learners at thousands of companies

Course Description

Being able to leverage transactions and find and handle errors is critical to building resilient SQL scripts and working with databases. Transactions provide the protection needed to ensure that your data is consistent and operations work on the desired data in concurrent environments. Improper error handling can cause many serious and unexpected issues. Without the proper use of transactions and error handling, it's possible to make decisions based on incorrect data leading to false outcomes. In this course, we'll cover proper ways to use transactions and handle errors with a record of what went wrong. Additionally, we discuss how concurrently plays into the use of transactions and data outcomes. We'll practice these concepts on the FFEIC bank health data and with a patient data table.

  1. 1

    Getting to know transactions

    This chapter focuses on learning about single and multistatement transactions and the read committed isolation level.
    Play Chapter Now
  2. 2

    Rolling back and Savepoints

    How to rollback when an error is encountered in a transaction block and setting savepoints.
    Play Chapter Now
  3. 3

    Handling exceptions

    In this chapter, you'll learn about exceptions and how to handle them.
    Play Chapter Now
  4. 4

    Stacked Diagnostics

    With stacked diagnostics, you can get all the information available from PostgreSQL about an exception.
    Play Chapter Now
FFEIC data
Amy Peterson
Intermediate SQL
Jason Myers Headshot

Jason Myers

Co-Author of Essential SQLAlchemy and Software Engineer
Jason Myers is a software engineer and author. His area of expertise is in developing data analytics platforms. He has also written the Essential SQLAlchemy book, co-authored with Rick Copeland, that introduces you to working with relational databases in Python.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA