{"id":82,"date":"2014-05-20T15:26:00","date_gmt":"2014-05-20T14:26:00","guid":{"rendered":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/20\/what-are-acid-properties\/"},"modified":"2024-09-06T19:49:13","modified_gmt":"2024-09-06T18:49:13","slug":"what-are-acid-properties","status":"publish","type":"post","link":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/20\/what-are-acid-properties\/","title":{"rendered":"What are ACID properties?"},"content":{"rendered":"<div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>2 Minute, 6 Second                <\/div>\n\n            <\/div><p>1. Atomicity<br \/>\nDefinition: Atomicity ensures that all operations within a transaction are completed successfully as a whole, or none of them are. If one part fails, the entire transaction fails and the system is rolled back to its previous state.<\/p>\n<p>Real-time Example: Imagine you&#8217;re transferring $500 from your bank account (Account A) to your friend&#8217;s account (Account B). The transfer involves two steps:<\/p>\n<p>Debit $500 from Account A.<br \/>\nCredit $500 to Account B.<br \/>\nIf the debit from Account A is successful but the credit to Account B fails, Atomicity will roll back the debit operation. The result is as if the transaction never happened, ensuring your account is not debited if the transfer fails.<\/p>\n<p>2. Consistency<br \/>\nDefinition: Consistency ensures that a transaction takes the database from one valid state to another, adhering to all defined rules (such as constraints, triggers, and data formats).<\/p>\n<p>Real-time Example: Suppose there\u2019s a rule in a retail database that says the quantity of a product cannot be negative. If you attempt to sell more units than are available, the transaction should fail to maintain the rule.<\/p>\n<p>You have 10 units of a product, and you attempt to sell 12 units. The transaction will fail due to the consistency rule, preventing the database from going into an invalid state (negative stock).<\/p>\n<p>3. Isolation<br \/>\nDefinition: Isolation ensures that multiple transactions happening at the same time do not interfere with each other. Each transaction should occur independently without affecting the other\u2019s outcome.<\/p>\n<p>Real-time Example: Imagine two customers trying to book the last available seat on a flight. Both users initiate the transaction at the same time. The isolation property ensures that only one transaction can successfully book the seat, and the other user\u2019s transaction will fail.<\/p>\n<p>If two people try to book the last seat on a flight, only one will succeed, while the other transaction will fail or be delayed, ensuring the database remains accurate and no double booking occurs.<\/p>\n<p>4. Durability<br \/>\nDefinition: Durability ensures that once a transaction is committed, it will remain permanent, even in the event of a system crash or failure.<\/p>\n<p>Real-time Example: After successfully transferring $500 to your friend\u2019s account (Account B), a power outage occurs. Durability ensures that when the system is restored, the $500 transfer is still recorded and not lost.<\/p>\n<p>After your $500 transfer is completed and committed to the database, even if the bank&#8217;s system crashes, the transaction will not be lost, and your friend will still have the credited amount.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Atomicity Definition: Atomicity ensures that all operations within a transaction are completed successfully as a whole, or none of them are. If one part fails, the entire transaction fails and the system is rolled back to its previous state. Real-time Example: Imagine you&#8217;re transferring $500 from your bank account (Account A) to your friend&#8217;s [&hellip;]<\/p>\n","protected":false},"author":43,"featured_media":330,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[27],"tags":[70,69,71],"class_list":["post-82","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-acid-properties","tag-database","tag-sqlinterview"],"uagb_featured_image_src":{"full":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920.jpg",1920,1080,false],"thumbnail":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920-150x150.jpg",150,150,true],"medium":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920-300x169.jpg",300,169,true],"medium_large":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920-768x432.jpg",750,422,true],"large":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920-1024x576.jpg",750,422,true],"1536x1536":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920-1536x864.jpg",1536,864,true],"2048x2048":["https:\/\/debuggersspace.com\/wp-content\/uploads\/2014\/05\/server-5451985_1920.jpg",1920,1080,false]},"uagb_author_info":{"display_name":"Himanshu Namdeo","author_link":"https:\/\/debuggersspace.com\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"1. Atomicity Definition: Atomicity ensures that all operations within a transaction are completed successfully as a whole, or none of them are. If one part fails, the entire transaction fails and the system is rolled back to its previous state. Real-time Example: Imagine you&#8217;re transferring $500 from your bank account (Account A) to your friend&#8217;s&hellip;","_links":{"self":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/82"}],"collection":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":2,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":331,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/82\/revisions\/331"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/media\/330"}],"wp:attachment":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}