What the CRUD?

CRUD a funny sounding word used to describe something unpleasant, but within the programming community it is part of the everyday lingo and couldn’t be more relevant. CRUD is the acronym which refers to the four functions necessary to implement and persist data in a storage application. CRUD stands for Create, Read, Update and Delete. So let’s break it down.

First, what is meant by “persisting data into a storage application”? Persistent storage refers to a data storage application that saves information even after the application is no longer in use. The data is being saved so we can always have access to it. Now that we have a basic understanding of data being stored in a database, let’s get back to CRUD.

CREATE

This is probably exactly what you are thinking. The Create function allows users to create new records in a database. You have probably interacted with many applications that let you do this. In the SQL database the CREATE function is called INSERT. A user might have the ability to create a new row in the users table once it has been created for them, but the administrator or programer is the only person that is able to add new attributes to the table itself.

READ

The READ function is like a search feature. It is looking through our data READING it, and then will give us back the answer to what we are searching for. In an application this would be how we might execute a search bar at the top of the application. The user would type in some information and our function would execute the search and return the results, or an error if nothing is found. This could also be used if there were filters in the application. We need READ in order to manipulate data and return specific results.

UPDATE

The UPDATE function is used to modify or UPDATE existing records. You might only give users the option to update a certain field or they can modify multiple fields or even the enter record. Whatever it is, you will be using UPDATE for this. An example of this from the backend perspective would be that an online clothing retail store might have to update the price of a product that went on sale. So they only want to modify the price portion in the database. The result of this change is updated in the database and then would be reflected on the existing product online. In SQL you can do this by using the function called Update.

DELETE

I’m not sure why, but this is my favorite of the four functions. Perhaps it is so satisfying to me to see the data be deleted. DELETE is obviously a very important function to understand because it involves removing records from a database that may no longer be needed. Let’s break DELETE down a little further. There are two different DELETEs: Hard Delete and Soft Delete. Hard Delete is used when something is permanently removed from the records of a database. Soft Delete is used to update the status of a row, it will indicate that it has been deleted while still leaving the data there intact.

CRUD is one of the most important things for a programmer to understand. Without the CRUD Operations software developers can’t get anything done. The ability to utilize these functions in a web application is crucial to the success of most full stack projects.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store