Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Transaction Creation | ACID
Quizzes & Challenges
Quizzes
Challenges
/
SQL Optimization and Query Features

bookChallenge: Transaction Creation

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:

Task

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.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 4.55

bookChallenge: Transaction Creation

Swipe to show menu

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:

Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 4
single

single

some-alt