written by
Phill Duffy

Data Basics: What is CRUD?

Insight 2 min read, August 28, 2019

In this data basics article, I want to talk through the idea of CRUD, which stands for Create, Read, Update and Delete most systems that deal with data are CRUD applications.

What is CRUD?

Talking CRUD

It is most likely Developers who will be use the term 'CRUD' - but it is useful for everyone from Project Managers, Business Analysts and Business Users to understand what functional requirements systems often have when dealing with data.

Create

Creating data is merely adding it where it didn't exist before. Good examples are adding a new item to your to-do list, submitting a new order to your favourite online shop or registering for an event. In each case, the system will create a new record with the relevant information

The examples below are using the JavaScript Object Notation - or as most people call it JSON (not you Jason)

Todo

{
id: 'f96cf573-ad4e-4a66-93c7-c63ce981ea1b'
task: 'build a new rocket'
due: 'Wednesday'
isComplete: false
}

Order

{
orderId: 'amzn-2929393'
productId: 'R0Ck37Fu3l'
productName: 'Rocket Fuel'
delivery: 'Friday'
price: '£400'
units: '300'
}

Event

{
id: 'jif7sfhj'
eventName: 'Launch Party'
day: 'Saturday
startTime: '12:25pm'
endTime: 'unknown'
status: 'active'
}

Read

Reading the information you put into the system is essential. There are many different ways that info can be read. In most systems, you can access a single record by using its unique identifier (ID). You can also find many items that match a particular property. Examples of many things are, show me all red items, show me new orders from the last week or issues that we have flagged for review.

SELECT Dimensions, ScrewsNeeded
FROM BluePrintsTable
WHERE id = 'Galatic3000'
SELECT Cost,Size,Instructions
FROM ControlPanelButtonsTable
WHERE Color = 'Red'
SELECT * 
FROM WhyThingWhenWrongLastTimeTable
WHERE isNeedUrgentReview = true

Update

Updating content is vital to ensure that it is still relevant or any changes get reflected in the system. Usually, the system retrieves a record by its ID, and the contents are updated, and then it is resubmitted and overwrites the item that existed with that ID

UPDATE EventsTable
SET status = 'complete'
WHERE id = 'jif7sfhj';
UPDATE HealthInsuranceTable
SET isHealthy = false, isLiability = 'veryMuchSo', ...
WHERE id = 'CrazyRocketGuy';

Delete

Delete is also fairly explanatory it will remove the record from the system. However, often, systems will update the record to show that it is no longer active without actually removing it. When required, the data will be deleted and gone forever (apart from backups!)

DELETE FROM IdeasTable
WHERE ideaName like 'rocket';