LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Transactions and Error Handling in PostgreSQL

Kurs anzeigen

Anleitung zur Übung

  • 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'.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

-- 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';
Code bearbeiten und ausführen