Что такое crud приложение

от admin

CRUD Operations – What is CRUD?

Kolade Chris

CRUD Operations – What is CRUD?

Despite being commonly pronounced /krʌd/ , CRUD is not a word. It’s an abbreviation that stands for Create, Read, Update, and Delete or Destroy.

In this article, I will show you what CRUD means, and what the individual terms mean and do. I will also show you how create, read, update, and delete operations work in the real world.

What We’ll Cover

What is CRUD?

CRUD refers to the four basic operations a software application should be able to perform – Create, Read, Update, and Delete.

In such apps, users must be able to create data, have access to the data in the UI by reading the data, update or edit the data, and delete the data.

In full-fledged applications, CRUD apps consist of 3 parts: an API (or server), a database, and a user interface (UI).

The API contains the code and methods, the database stores and helps the user retrieve the information, while the user interface helps users interact with the app.

You can make a CRUD app with any of the programming languages out there. And the app doesn’t have to be full stack – you can make a CRUD app with client-side JavaScript.

In fact, the app with which I will be showing you how create, read, update and delete operations work is made with client-side JavaScript.

Each letter in the CRUD acronym has a corresponding HTTP request method.

CRUD Operation HTTP Request Method
Create POST
Read GET
Update PUT or PATCH
Delete DELETE

What is the CREATE Operation and How Does it Work?

In CRUD, the create operation does what the name implies. It means creating an entry. This entry could be an account, user information, a post, or a task.

As I pointed out earlier, the HTTP protocol that implements a CREATE operation is the POST method.

In a SQL database, to create is to INSERT . In a NoSQL database like MongoDB, you create with the insert() method.

In a user interface, this GIF below shows how the CREATE operation works:

What is the READ Operation and How Does it Work?

The READ operation means getting access to the inputs or entries in the UI. That is, seeing it. Again, the entry could be anything from user information to social media posts, and others.

This access could mean the user getting access to the created entries right after creating them, or searching for them. Searching is implemented to allow the user to filter out the entries they don’t need.

The HTTP protocol that implements a READ operation is the GET method.

read-operation

In a SQL database, to read is to SELECT an entry. In a NoSQL database like MongoDB, you read with the find() or findById() method.

What is the UPDATE Operation and How Does it Work?

UPDATE is the operation that allows you to modify existing data. That is, editing the data.

Unlike READ , the UPDATE operation alters the existing data by making changes to it.

PUT and PATCH are the HTTP protocols with which you can implement an UPDATE operation, depending on what you need.

PUT should be used when you want the entire entry updated, and PATCH if you don’t want the entire entry to be modified.

In a SQL database, you use UPDATE to update an entry. In a NoSQL database like MongoDB, you can implement an update feature with the findByIdAndUpdate() method.

In a user interface, this GIF below shows how the UPDATE operation works:

What is the DELETE Operation and How Does it Work?

To delete is to get rid of an entry from the UI and the database.

DELETE is the HTTP protocol for implementing a DELETE operation.

In a SQL database, DELETE is used to delete an entry. In a NoSQL database like MongoDB, you can implement delete with the findByIdAndDelete() method.

Conclusion

This article showed you what CRUD means and what each individual operation in a CRUD app does.

You can think about CRUD in this way:

  • You create a social account and fill in your information — CREATE
  • You get access to the information you entered and people can search for you – READ
  • You get a new job at Google and changed your employment status to employed – UPDATE
  • You get tired of social media toxicity and delete your account — DELETE

To learn how you can make your own CRUD app, check out this tutorial by Joy Shaheb of freeCodeCamp.

Что такое CRUD-операции

CRUD-операции

Изучение

Если вы когда-либо работали с базами данных, вы, вероятно, использовали операции CRUD. CREATE, READ, UPDATE и DELETE — это четыре основные операции программирования РСУБД. Операции CRUD используются для управления, чтения, вставки, удаления и редактирования данных таблицы.

SQL играет важную роль в большинстве отраслей, поэтому разработчикам во всем мире важно понимать, как работают операции CRUD. В этой статье мы познакомим вас с операциями CRUD с SQL.

Что такое операции CRUD?

Любые организации, отслеживающие данные (например, учетные записи, платежную информацию или другие записи), нуждаются в системах, обеспечивающих постоянное хранение, которое обычно организовано в базу данных. Реляционная база данных состоит из данных, организованных по строкам и столбцам. Их можно подключить к другим таблицам с помощью первичных и внешних ключей.

CRUD (создание, чтение, обновление, удаление) — это аббревиатура, обозначающая четыре функции, которые мы используем для реализации приложений постоянного хранения и приложений реляционных баз данных, включая Oracle Database, Microsoft SQL Server и MySQL.

В таблице ниже показано, что означает каждая операция CRUD.

Письмо Операция Функция
C Создавать Вставлять
р Читать Выбирать
U Обновлять Редактировать
D Удалить Удалить

Для SQL карты CRUD для вставки, выбора, обновления и удаления соответственно. Такие операции, как управление безопасностью, управление транзакциями, доступ и разрешение, а также оптимизация производительности, основаны на CRUD.

Почему CRUD так важен?

CRUD постоянно используется для всего, что связано с базами данных и проектированием баз данных. Разработчики программного обеспечения ничего не могут сделать без операций CRUD. Например, при разработке веб-сайтов используется REST (передача репрезентативного состояния), который является надмножеством CRUD, используемого для ресурсов HTTP.

С другой стороны, CRUD не менее важен для конечных пользователей. Без него такие вещи, как регистрация на веб-сайтах, создание блогов или закладок, были бы невозможны. Большинство приложений, которые мы используем, позволяют нам добавлять или создавать новые записи, искать существующие, вносить в них изменения или удалять их.

CRUD предлагает множество преимуществ, в том числе:

  • Это облегчает контроль безопасности, удовлетворяя различные требования доступа.
  • Он упрощает и упрощает разработку приложений, делая их более масштабируемыми.
  • Он имеет лучшую производительность по сравнению со специальными операторами SQL.

CREATE

Create позволяет добавлять новые строки в вашу таблицу. Вы можете сделать это с помощью команды INSERT INTO. Команда начинается с INSERT INTOключевого слова, за которым следует имя таблицы, имена столбцов и значения, которые нужно вставить.

При использовании у INSERT INTOвас есть два варианта:

В приведенном ниже примере мы добавим данные в нашу таблицу пекарни.

Это добавит новые строки в таблицу меню, и каждая запись будет иметь уникальный id.

Функция чтения похожа на функцию поиска, поскольку позволяет извлекать определенные записи и считывать их значения. Читать относится кSELECT

Например, давайте посмотрим на товары, которые мы продаем в нашей пекарне. Для этого мы должны отобразить все данные в нашей таблице меню, используя:

Это не внесет никаких изменений в таблицу меню, а просто отобразит все записи в этой таблице.

Взгляните на этот пример, чтобы увидеть, как SELECTизвлекаются желаемые данные:

UPDATE

Обновление — это то, как мы изменяем существующую запись в таблице. Мы можем использовать это для изменения существующих записей в базе данных. При выполнении UPDATEвам необходимо определить целевую таблицу и столбцы, которые необходимо обновить. Вам также понадобятся связанные значения, а иногда и строки.

Рекомендуется ограничить количество строк, так как это помогает избежать проблем с параллелизмом.

Чтобы обновить существующую запись, используйте следующее:

Допустим, мы хотим обновить название и цену товара. Мы бы использовали:

Это обновит таблицу, так что предыдущая запись с id 1теперь будет заменена шоколадным круассаном с price 2.5.

DELETE

Удалить используется для удаления записи из таблицы. SQL и имеет встроенную функцию удаления для одновременного удаления одной или нескольких записей из базы данных. Некоторые приложения реляционных баз данных могут разрешать жесткое удаление (безвозвратное удаление) или мягкое удаление (обновление статуса строки).

Команда удаления выглядит следующим образом:

Если мы хотим удалить один элемент из таблицы, мы используем:

Это приведет к удалению строки с хлебным предметом из таблицы. Если вы хотите удалить все записи из таблицы, вы можете использовать:

Следующие шаги для вашего обучения

В этой статье мы рассмотрели, что такое CRUD и как он используется в SQL. Эти операции будут иметь важное значение для вашей карьеры в области SQL. Вы будете использовать CRUD во всевозможных приложениях, базах данных и общих задачах программирования.

Если вы хотите узнать больше о SQL, вы можете начать со следующих тем:

  • Базовый SQL
  • Присоединяется
  • Хранимые процедуры
  • Триггеры

Для начала ознакомьтесь с Вводным руководством по SQL для образовательных учреждений. Вы узнаете обо всех основах SQL и познакомитесь с операциями CRUD. Вы будете охватывать все, от создания и обновления баз данных до объединений, вложенных запросов, хранимых процедур, триггеров, и все это в практической среде.

What is CRUD?

If you are new to programming, seeing “CRUD” in the title may raise concerns considering that the Merriam-Webster dictionary defines crud as either “a deposit or incrustation of grease or a slang for a contemptible person.” As fun as it may be to expand on that definition, this is not what we will be expanding on for this article. In the computer programming world, CRUD is an acronym worth knowing. We will review what CRUD operations (aka CRUD functionalities) are and why it is an important fundamental to learn early on.

CRUD is an acronym that stands for Create, Read, Update and Delete.Think of CRUD as a simple concept that represents the four basic functions that models should be able to do and are considered necessary to implement a persistent storage application. In simpler terms, it represents the four basic operations you can do on any data. You can create something new, read or view the newly created data, edit or update the data and finally the option to delete it.

CRUD Functions

These four major functions are used to interact with database applications and is a reminder of what data manipulation functions are needed for an application to feel complete. When working with web services, CRUD corresponds to the to HTTP methods, which communications to a web server how you want to interact with a website.

In this breakdown, I will use my New Beginnings project as an example for the CRUD functions and the HTTP requests associated with them. This was my first (Ruby/HTML) application that was built for a local animal shelter where users can create an account, log in, browse all animals for adoption and schedule playdates or adopt them directly from the site.

Create

After logging into the New Beginnings site, browsing all the animals available for adoption, we’d click on Togo’s name. Once we’ve been directed to his show page, we can create a playdate with him at the shelter. After we complete the appointment form, those inputs are then correlated to the model table in the database. When we submit the data, a POST requested is sent to our API and our playdate with Togo will be stored in the database.

  • The route for this POST request — /appointments/new

Nice! We’ve scheduled our playdate with Togo, but now we want to see that confirmation on our page right? After all, read is the main functionality for us to use the other operations. Now, our API should allow us to see the playdate confirmation on our page. To take a look at all of our appointments, we would use a GET request that allows us to view the scheduled appointment without making any changes to the data stored on our API. This HTTP method is used to only retrieve data and should have no other effects.

  • The route for this GET request — /appointments.

Update

Togo is really adorable, maybe we should see him sooner! For us to reschedule the appointment for an earlier time we can use the corresponding HTTP method for updating your playdate with PUT. This replaces all current data of the target resource (Togo) with the uploaded content (new appointment time/date). The ‘id’ in the route is how the resource is targeted (Togo) to ensure we only update the specified appointment, while leaving any others we may have scheduled untouched.

  • The route for this PUT request — /appointments/:id.

Delete

You know what? Togo has been so helpful with these CRUD functionalities, I think we should just bring him home. Since we can adopt Togo directly from the app, let’s go ahead and cancel the playdate we scheduled. To do this, we can use the HTTP method, DELETE, to remove the targeted appointment from our page. To reiterate, each playdate has a unique id and the id in the request below identifies the specific appointment you are removing from the database.

  • The route for the DELETE request — /appointments/:id

Conclusion

However simple these four actions may seem, they can be found everywhere because they add important functionality that are vital to modern day web development. As a developer, I encourage you to build your applications around this basic functionality. Remember to use CRUD as a guideline in the initial stages of development to help think through what a user should or should not be able to do within your app. So, get creative and show the world what you can build!

What is a CRUD app and how to build one | Ultimate guide

We use CRUD apps every day. Most of the time, without noticing. They keep us organized, they help digitise business processes, and they’re critical to application development. But many of us are oblivious to what CRUD apps are, or how to build one. Within this post, I am to provide you with a simple and straightforward guide to the world of CRUD apps. The guide is broken down into three sections:

What is a CRUD App

A CRUD app is a specific type of software application that consists of four basic operations; Create, Read, Update, Delete.

At a high level, CRUD apps consist of three parts; the database, user interface, and APIs.

Database

The database is where your data is stored. A database management system is used to manage the database. There are several different types of database management systems (DBMS) that can be categorized by how they store data; relational (SQL), Document (NoSQL). If you are deciding what DBMS to choose for your CRUD app, here’s a list of the 14 best database management systems . Going forward, our content will focus on SQL. SQL databases consist of tables. Tables consist of records. Records consist of fields. Fields consist of data.

User Interface

The user interface (UI) is what your users interact with. Due to the increasing popularity of applications, businesses are now prioritizing user interface design and user experience.

Finally, the APIs are how your application informs your database of what functions to perform. These functions can be modeled in different ways but they are designed to perform four basic CRUD operations; Create, Read, Update, Delete.

CRUD operations

As previously mentioned, there are four basic CRUD operations; create, read, update and delete. These four operations map to functions/statements, as seen in the following table:

OPERATIONS FUNCTIONS
Create Insert
Read Select
Update Update
Delete Delete

Each letter in CRUD can also be mapped to an HTTP protocol method:

OPERATIONS HTTP PROTOCOL
Create Post
Read Get
Update Put
Delete Delete

Let’s dive deeper into each of the CRUD operations. We’ve used a library management app as an example to help with learning.

Create

Create allows you to add new rows/records to a database/table. If the record does not exist, the create operation adds it to the database.

Recipe example

  1. Create/add a new book to our library management app

Read is the operation that allows us to see the recipe we just created. It does not alter data. It simply displays it. Read consists of a function that queries our database and fetches all our records, in this case, recipes. We can tailor our queries to pull back all recipes, or only recipes of a particular type (for example,, vegan recipes). We can also pull back a single recipe if we have a UID (unique identifier).

Recipe example

  1. View the books within our library
Update

Update is the operation that allows us to modify existing data and records within a table. We can update a single field within a record or multiple fields at once. It is also possible to update multiple records at once too.

Recipe example

  1. Update a book’s availability
Delete

Delete is the operation that allows us to remove records from a table.

Recipe example

  1. Remove a book from our library management system

Two additional basic CRUD app examples

Recipe app
  1. Create — Add a new recipe to my recipe app
  2. Read — View recipes in my recipe app
  3. Update — Update the carbonara recipe in our recipe app to use guanciale instead of bacon
  4. Delete — Remove the carbonara recipe from my recipe app
Project management app
  1. Create — Insert a new task in your project management tool
  2. Read — View all open tasks
  3. Update — Mark a task as ‘complete’
  4. Delete — Remove a task from your project management app

CRUD app ideas

If you want to get started and work on CRUD app ideas, this section provides you with some inspiration.

In general, whenever you see data storage there is potential for a CRUD app. From something as simple as a to-do list to complex software and apps.

CRUD use cases

There are several use cases for CRUD apps, including:

  • Event management app,
  • Student portal,
  • Sports club membership app,
  • Book club app,
  • Content marketing calendar,
  • OKRs app,
  • To-do app,
  • Project management app,
  • Applicant tracking system.
What are CRUD projects?

You can create CRUD projects in any application that requires data storage. They can range from a simple standalone table to complex projects with hundreds of interlinked tables.

Another interesting aspect is that many daily tasks are based around CRUD software even if users don’t realize it. For example, a spreadsheet containing your monthly finances uses CRUD operations.

That is, you can create, read, update and delete data from it.

CRUD platforms / frameworks / tech stacks

There are many, low code platforms, frameworks, or tech stacks that provide an effective workflow when creating CRUD apps. The following are options you might consider:

  • Budibase
  • Python and Django
  • LAMP — Linux, Apache, MySQL, PHP
  • Supabase and Next.js
  • MEAN — Mongo, Express, Angular, Node.js

How to build a simple CRUD app

Budibase is a low code platform that is designed for creating CRUD applications. From the frameworks, tech stacks, and platforms listed above, Budibase is the easiest and fastest way to build a CRUD application. For these reasons, we will use Budibase to build our CRUD app.

Overview

A local library is currently using an spreadsheet to manage their catalogue of books, and they would like to upgrade to a CRUD application.

  1. Make it easier to add new books
  2. Make it easier to search books
  3. Make it faster to check the availability of books
  4. Improve the experience when updating book information, including availability
  5. Make it possible to assign users to books
  6. Improve the experience around deleting books

Building our library management CRUD app

There are three high-level steps to building our CRUD app; setting up Budibase, create our data structure, and designing our user interface.

Setting up Budibase

If you are new to Budibase, click the ‘Get started’ button in the navigation (if on mobile, click the burger menu, then the ‘Get started’ button). Once you have Budibase setup, follow the actions below:

Actions:
  • Click the ‘Create new app’ button.
  • Give your app a name. We are going to call our app the ‘Library management app’ — very original.
Create your data structure

Budibase has its own database and supports several others; including MySQL, PostgreSQL, Mongo, and more. For our CRUD app, we will simply use Budibase’s internal database — Budibase DB.

Actions:

Похожие статьи