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.
Bu egzersiz
Transactions and Error Handling in PostgreSQL
kursunun bir parçasıdırEgzersiz talimatları
BEGINthe transaction.- Update the
RCONP752field to be'true'whereRCON2365is bigger than $5,000,000. - Close out the transaction with
COMMIT. - Select the count of rows where
RCONP752is'true'.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
-- 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';