DEV Community

Seonyoung Chloe (she/they)
Seonyoung Chloe (she/they)

Posted on

38: Create, read, update and delete

In computer programming, create, read, update, and delete1 are the four basic functions of persistent storage.

Alternate words are sometimes used when defining the four basic functions of CRUD, such as retrieve instead of reading, modify instead of update, or destroy instead of delete.


CRUD is also sometimes used to describe user interface conventions that facilitate viewing, searching, and changing information; often using computer-based forms and reports.


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 Structured Query Language (SQL) statement, Hypertext Transfer Protocol (HTTP) method (this is typically used to build RESTful APIs[4]) or Data Distribution Service (DDS) operation


The comparison of the database-oriented CRUD operations to the HTTP methods has some flaws.

Strictly speaking, both PUT and POST can create and update resources; the key difference is that contrary to POST, PUT is idempotent, meaning that multiple identical requests should have the same effect as a single request. Consequently, PUT is a "replace" operation, which one could argue is not "update".


Although a relational database provides a common persistence layer in software applications, numerous other persistence layers exist. CRUD functionality can, for example, be implemented with object databases, XML databases, flat text files, or custom file formats. Some (big data) systems do not implement UPDATE, but have only a timestamped INSERT (journaling), actually storing a new version of the object. As a consequence, they do not have transactions either and might miss consistency.


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. As a bare minimum, the software must allow the user to

  • create or add new entries;
  • read, retrieve, search, or view existing entries;
  • update or edit existing entries;
  • delete, deactivate, or remove existing entries.

Without at least these four operations, the software cannot be considered complete. Because these operations are so fundamental, they are often documented and described under one comprehensive heading, such as "contact management", "content management" or "contact maintenance" (or "document management" in general, depending on the basic storage unit for the particular application).

CRUD

Top comments (0)