COMPUTER STUDIES

CRUD AND ACID

CRUD

In computer programming, CRUD is an acronym for create, read, update and delete which are the four basic functions of persistent storage. It is also sometimes used to describe user interface conventions that facilitate viewing, searching, and changing information; often using computer-based forms and reports. Another variation of CRUD is BREAD, an acronym for “Browse, Read, Edit, Add, Delete”.

CRUD is also relevant at the user interface level of most applications. For example, in address book software, the basic storage unit is an individual contact entry. The software must allow the user to:

  1. Create or add new entries.
  2. Read, retrieve, search, or view existing entries.
  3. Update or edit existing entries.
  4. Delete/deactivate existing entries.

The acronym CRUD refers to all of the major functions that are implemented in relational database applications. Each letter in the acronym can map to a standard SQL statement and HTTP method:

 

ACID

In computer science, ACID is an acronym for atomicity, consistency, isolation, durability which is a set of properties that guarantee that database transactions are processed reliably. In the context of databases, a single logical operation on the data is called a transaction. For example, a transfer of funds from one bank account to another, even involving multiple changes such as debiting one account and crediting another, is a single transaction.

  • Atomicity: Atomicity requires that each transaction is “all or nothing”: if one part of the transaction fails, the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes.
  • Consistency: The consistency property ensures that any transaction will bring the database from one valid state to another. Any data written to the database must be valid according to all defined rules, including but not limited to constraints, cascades, triggers, and any combination thereof.
  • Isolation: The isolation property ensures that the concurrent execution of transactions results in a system state that could have been obtained if transactions are executed serially, i.e. one after the other. Each transaction has to execute in total isolation.
  • Durability: Durability means that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be stored permanently (even if the database crashes immediately thereafter).

 

Examples: The following examples are used to further explain the ACID properties. In these examples, the database table has two fields, A and B, in two records. An integrity constraint requires that the value in A and the value in B must sum to 100. The following SQL code creates a table as described above:

CREATE TABLE acidtest (A INTEGER, B INTEGER CHECK (A +B= 100))

Leave a Reply

Your email address will not be published. Required fields are marked *

Advantages of local domestic helper.