ComeçarComece de graça

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.

Este exercício faz parte do curso

Transactions and Error Handling in PostgreSQL

Ver curso

Instruções do exercício

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

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

-- 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';
Editar e executar o código