Skip to main content

CRUD

Create, Read, Update, Delete

Pronunciation
KRUD
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/crud

In short

CRUD stands for create, read, update and delete, the four basic operations for working with stored data in databases, APIs and most business applications.

What is CRUD?

CRUD names the four things you can do with a stored record: create a new one, read existing ones, update one, and delete one. Nearly every application that stores data, from a to-do list to a banking system, is built around these operations, which is why simple data-management apps are often called CRUD apps.

In SQL, the four operations map to INSERT, SELECT, UPDATE, and DELETE. In a REST API, they usually map to HTTP methods on a resource URL: POST /tasks creates, GET /tasks/7 reads, PUT or PATCH /tasks/7 updates, and DELETE /tasks/7 deletes. ORMs and many web frameworks can generate CRUD code, admin screens, and API endpoints for a data model automatically, which saves a lot of repetitive work.

CRUD is like managing a paper address book: you write in a new contact, look someone up, cross out and correct a phone number, or tear out a page. Real applications wrap rules around each operation, such as validation before creating or updating, authorization checks on who may read or delete, and pagination when reading long lists. Many systems also avoid permanent deletes with a soft delete, which only marks a record as deleted, for example with a deleted_at timestamp, so it can be restored or audited later.

CRUD is often confused with REST. CRUD describes operations on data, while REST is an architectural style for designing APIs; a REST API often exposes CRUD operations, but REST also covers ideas such as statelessness and resource URLs, and many API actions, like 'send a password reset email' or 'approve an order', aren't CRUD at all. CRUD is also contrasted with CQRS, an architecture that separates the write side of an application from the read side into different models.

Key takeaways

  • CRUD stands for create, read, update, and delete.
  • In SQL, the operations are INSERT, SELECT, UPDATE, and DELETE.
  • In REST APIs, they usually map to POST, GET, PUT or PATCH, and DELETE.
  • Real CRUD features add validation, authorization, and pagination.
  • CRUD describes operations on data; REST describes how an API is designed.

Example

The four CRUD operations in SQLsql
-- Create
INSERT INTO tasks (title, done) VALUES ('Write report', false);

-- Read
SELECT id, title, done FROM tasks WHERE done = false;

-- Update
UPDATE tasks SET done = true WHERE id = 7;

-- Delete
DELETE FROM tasks WHERE id = 7;

-- The same operations in a REST API:
-- POST /tasks, GET /tasks/7, PATCH /tasks/7, DELETE /tasks/7

Readers ask

What is a CRUD app?

A CRUD app is an application whose main job is to create, view, edit, and delete records, such as an inventory manager or an admin panel. Most business software starts out as CRUD and then adds workflows, rules, and reports on top.

How do CRUD operations map to HTTP methods?

Create usually maps to POST, read to GET, update to PUT (full replacement) or PATCH (partial change), and delete to DELETE. This mapping is a convention of REST APIs rather than a strict rule.

What is a soft delete?

A soft delete marks a record as deleted, for example by setting a deleted_at column, instead of removing it from the database. Queries then filter out soft-deleted rows, and the data can still be restored or audited.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings