|
|
|
|
|
by MattRogish
36 days ago
|
|
“I intentionally wrote the example code the way a beginner might. More experienced users would probably reach for solutions like:
Updating and checking the balance in a single UPDATE Using [check constraints]to ensure an account balance can never be negative.”
Not the author but presumably ALTER TABLE foo ‘ADD CONSTRAINT BalanceCantBeNegative CHECK( balance >= 0 )’ |
|