Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Transaction Creation | Section
Advanced SQL for Backend Developers
Seksjon 1. Kapittel 3
single

single

bookChallenge: Transaction Creation

Sveip for å vise menyen

Let's walk through creating a transaction ourselves based on the BankAccounts table described in the previous chapter.

We're going to perform a straightforward financial transaction: transferring funds from one account to another. Ensuring that both steps occur as a single logical unit exemplifies a real-life transaction.

We will work with account numbers 101 and 789 and the initial balance will be the following:

Oppgave

Swipe to start coding

Fill in the blanks to create a SQL transaction that transfers 500 from account 101 to account 789. Make sure the transaction starts and ends correctly using the appropriate SQL keywords.

  • Start the transaction using the correct SQL keyword.
  • Deduct 500 from account 101 only if there is enough balance.
  • Add 500 to account 789 only if the deduction was successful.
  • End the transaction using the correct SQL keyword.
  • Retrieve the updated balances for both accounts at the end.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 3
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt