CRUD

Also known as: Create, read, update, delete

On this page 7

CRUD is an acronym for create, read, update, delete, the four basic operations that any system storing persistent data must support. In databases, it describes the complete life cycle of a record: inserting it, retrieving it, changing it and removing it. The term is one of the database fundamentals because almost every application feature, from a contact form to a banking ledger, reduces to some combination of these four actions.

CRUD is a conceptual vocabulary, not a technology. It maps onto SQL statements, HTTP methods, document store commands and user interface patterns alike, which makes it a shared language between database designers, back-end developers and product teams.

How the four CRUD operations work

Each CRUD operation changes or observes the state of stored data in a distinct way. Create adds a new record, read retrieves existing records without modifying them, update changes attribute values of existing records, and delete removes records permanently or marks them as removed.

In a relational database, the operations correspond directly to the data manipulation statements of SQL. The table below shows the mapping together with the effect on the table.

OperationSQL statementEffect on dataChanges state
CreateINSERTAdds one or more new rowsYes
ReadSELECTReturns matching rowsNo
UpdateUPDATEModifies column values in existing rowsYes
DeleteDELETERemoves rows from the tableYes
CRUD operations and their SQL equivalents

Only read is free of side effects at the data level. The three writing operations are subject to constraints: a create can fail on a duplicate primary key, an update can violate a check constraint, and a delete can be blocked by a foreign key that enforces referential integrity.

CRUD across interfaces and technologies

CRUD appears at every layer of an application stack, not only inside the database. A web API exposes resources through HTTP methods, an object-relational mapping library exposes methods on entity objects, and a document database offers its own commands, yet all of them express the same four intentions.

The following table compares how common interfaces implement each operation.

OperationREST over HTTPTypical ORM callDocument store command
CreatePOSTsave or addinsertOne
ReadGETfind or getfind
UpdatePUT or PATCHsave after changeupdateOne
DeleteDELETEremove or deletedeleteOne
CRUD mapped to common interfaces

The mapping is conventional rather than exact. HTTP PUT replaces a whole resource and is idempotent, while PATCH applies a partial change; POST can also trigger actions that are not creations. Treating every endpoint as plain CRUD therefore oversimplifies APIs that model business processes such as approving an invoice or shipping an order.

Transactions, concurrency and data integrity

CRUD operations become reliable only when they run inside transactions with ACID guarantees. Atomicity ensures that a multi-step change either completes fully or not at all, and isolation determines what concurrent readers and writers see while a change is in progress.

Concurrency introduces characteristic anomalies. Two users who read the same record and then update it can cause a lost update, in which the second write silently overwrites the first. Systems prevent this with pessimistic locking (row locks taken before the change) or optimistic concurrency control, which checks a version number or timestamp at update time and rejects stale writes.

This table lists the main integrity risks per operation and the usual safeguards.

OperationTypical riskCommon safeguard
CreateDuplicate recordsUnique constraint or natural key
ReadDirty or inconsistent readsAppropriate isolation level
UpdateLost updatesVersion column or row locking
DeleteOrphaned child rowsForeign key with restrict or cascade
Integrity risks and safeguards per operation

In OLTP systems, these safeguards matter more than raw speed, because a fast but inconsistent write can corrupt financial or inventory data in ways that are expensive to repair.

Variants: soft deletes, audit trails and CRUDL

Real systems often modify the basic CRUD model to meet legal, analytical or usability needs. The most common change concerns delete, because permanent removal destroys history that auditors, analysts or users may later require.

  • Soft delete: a flag or timestamp column marks a row as deleted, and queries filter it out, so the record can be restored.
  • Audit trail: triggers or application code record who changed what and when, often in a separate history table.
  • CRUDL: adds list as a fifth operation to distinguish retrieving a collection with paging from reading a single item.
  • Append-only models: event sourcing never updates or deletes; it stores every change as a new event and derives current state from the log.
  • Temporal tables: the SQL standard supports system-versioned tables that keep previous row versions automatically.

Each variant has a cost. Soft deletes complicate every query and unique index, and they can conflict with data protection rules that require genuine erasure of personal data.

Limitations and common design mistakes

CRUD is a useful baseline, but designing an application purely around CRUD tends to produce systems that mirror tables instead of business intent. The result is often called an anemic design, in which rules are scattered across clients because the interface only exposes raw record edits.

Typical mistakes include generic update endpoints that let clients change any field, which bypasses validation and authorization checks per field; deleting parent records without a defined policy for dependent rows; and issuing one read per row in a loop, the N+1 query problem frequently caused by careless ORM use. Many teams therefore keep CRUD for simple reference data and model core workflows as explicit commands with their own validation.

The simple explanation

Imagine a paper address book. You can write in a new contact, look up a phone number, cross out an old address and write the new one, or tear out a page for someone you no longer know. That is all you ever do with it.

CRUD names these same four actions for computer data: create, read, update and delete. Almost every app, from a shopping site to a fitness tracker, is built on them. The hard part is not the actions themselves but doing them safely when many people use the same data at once.

How it is used in practice

A regional clinic builds a patient scheduling system on a relational database. Receptionists create appointments with INSERT statements, doctors read the daily schedule with SELECT queries, rescheduling triggers an UPDATE, and cancellations are recorded as soft deletes with a cancellation timestamp so that no-show statistics remain available.

Early testing reveals that two receptionists can book the same 9:30 slot at once. The developers add a unique constraint on doctor and start time and a version column for optimistic locking. Conflicting bookings now fail with a clear message instead of creating a double booking.

After launch, the system handles about 1,200 appointments per week, and the audit table shows every change with user and time. The outcome is a schedule that staff trust, with no double bookings and a complete change history.