Exercise: ACID Properties
Practice and test your understanding of ACID properties.
We'll cover the following...
Let’s get some hands-on practice.
Question 1
Given the following structure of the Categories
table:
Field | Type |
|
|
|
|
Where CategoryID
is the primary key. The table contains information about categories of products.
Write a SQL transaction that attempts to add a new category, Office Supplies, to the Categories
table. If successful, commit it. If it somehow fails (e.g., if a constraint was violated), it should theoretically roll back.
-- Add a new category with transaction and conditional commit or rollback
If you’re stuck, click the “Show Solution” button.
Question 2
Given the structure of the Suppliers
table:
Field | Type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The Suppliers
table stores detailed information about the suppliers, such as their name, contact details, and performance metrics.
Write a transaction that attempts to ...