What is CRUD?
CRUD is an acronym that stands for Create, Retrieve/Read, Update, Delete. It represents the basic facilities that an application must provide to its users.
What are the applications of CRUD?
Let's look at a word editor—one of the most common applications ever.
The word editor must have functions that allow you to:
- Create new documents
- View all documents that have been created in the past
- Update documents that you've already created
- Delete documents
We can drill this down to even the level of text written in one document. (Say what now? 🧐)
Well, any text editor that you use should allow you to:
- Add more text
- Edit existing text
- Delete text
- View all the text that has been added to the document
And that's CRUD! (Ta-daa 🙃)
CRUD for databases and APIs
CRUD is usually used in the context of databases or APIs. Here's how CRUD maps to the major functionalities offered by databases and APIs:
Databases
For relational databases (such as MySQL), CRUD maps to the major functions of SQL (the querying language that you use to work with relational databases):
- Create: INSERT
- Retrieve: SELECT
- Update: UPDATE
- Delete: DELETE
APIs
In case of APIs, this is how CRUD maps:
- Create: POST/PUT
- Retrieve: GET
- Update: POST/PUT/PATCH
- Delete: DELETE
Think we're missing something? 🧐 Help us update this article by sending us your suggestions here. 🙏