Get startedGet started for free

Making our first transaction

Now you're ready to build your first transaction. As mentioned in the slides, you are working with data from the FFEIC, which is the organization in the US that sets bank standards and reporting formats. Recently they changed the rules for reporting if you provide consumer deposit accounts to being true only if you have more than $5,000,000 in brokered deposits.

Let's use a transaction to make that update safely. The "Provides Consumer Deposits" flag is in the RCONP752 column and the brokered deposits is in the RCON2365 column.

This exercise is part of the course

Transactions and Error Handling in PostgreSQL

View Course

Exercise instructions

  • BEGIN the transaction.
  • Update the RCONP752 field to be 'true' where RCON2365 is bigger than $5,000,000.
  • Close out the transaction with COMMIT.
  • Select the count of rows where RCONP752 is 'true'.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Begin a new transaction
___;

-- Update RCOP752 to true if RCON2365 is over 5000000
UPDATE ffiec_reci
___ RCONP752 = 'true'
WHERE RCON2365 > ___;

-- Commit the transaction
___;

-- Select a count of records now true
SELECT COUNT(RCONP752)
FROM ffiec_reci
WHERE ___ = 'true';
Edit and Run Code