Exercise: ACID Properties
Explore practical exercises that reinforce ACID properties in database transactions by creating, updating, and managing data with commit and rollback controls, ensuring data integrity and consistency.
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.
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. ...