======================================================================
= Create,_read,_update_and_delete =
======================================================================
Introduction
======================================================================
In computer programming, create, read, update, and delete (CRUD) are
the four basic operations (actions) of persistent storage. CRUD is
also sometimes used to describe user interface conventions that
facilitate viewing, searching, and changing information using
computer-based forms and reports.
History
======================================================================
The term 'CRUD' was likely first popularized in 1983 by James Martin
in his book 'Managing the data-base environment'.
Conceptual
======================================================================
Data can be put in a 'location/area' of a storage mechanism.
* The fundamental feature of a storage location is that its 'content'
is both 'readable' and 'updatable'.
* Before a storage location can be read or updated it needs to be
'created'; that is allocated and initialized with content.
* At some later point, the storage location may need to be
'destructed'; that is finalized and deallocated.
Together these four operations make up the basic operations of storage
management known as CRUD: 'Create', 'Read', 'Update' and 'Delete'.
Databases
===========
The acronym CRUD refers to the major operations which are implemented
by databases. Each letter in the acronym can be mapped to a standard
Structured Query Language (SQL) statement.
CRUD SQL
Create INSERT
Read SELECT
Update UPDATE
Delete DELETE
Although relational databases are a common persistence layer in
software applications, numerous other persistence layers exist. CRUD
functionality can for example be implemented with document databases,
object databases, XML databases, text files, or binary files.
Some big data systems do not implement UPDATE, but have only a
timestamped INSERT (journaling), storing a completely new version of
the object each time.
RESTful APIs
==============
The acronym CRUD also appears in the discussion of RESTful APIs. Each
letter in the acronym may be mapped to a Hypertext Transfer Protocol
(HTTP) method:
CRUD HTTP
Create POST, PUT if we don't have `id` or `uuid`
POST is a CRUD operation in the same way as SQL INSERT. If the key
is specified in INSERT, then the equivalent REST is indeed PUT. On
the other hand, if a table autogenerates the key and the INSERT
doesn't have the key, then the equivalent REST is POST. "that doesn’t
mean we can live without it. POST serves many useful purposes in
HTTP." It is the standard way of creating a new object where the
server assigns the id. We can't help that in all other ways, POST is
as loosy goosy as Roy said. The user agent doesn't always have the
onus of knowing the key/id when creating in web or relational
databases. Knowing the key when creating is NOT a requirement of CRUD,
SQL, or REST. --> Read GET
Update PUT to replace, PATCH to modify
Delete DELETE
In HTTP, the GET (read), PUT (create and update), POST (create - if we
don't have `id` or `uuid`), and DELETE (delete) methods are CRUD
operations as they have storage management semantics, meaning that
they let user agents directly manipulate the states of target
resources. The POST method, on the other hand, is a process operation
that has target-resource-specific semantics which typically exceed the
scope of CRUD operations.
User interface
================
CRUD is also relevant at the user interface level of most
applications. For example, in address book software, the basic storage
unit is an individual 'contact entry'. As a bare minimum, the software
must allow the user to:
* 'Create', or add new entries
* 'Read', retrieve, search, or view existing entries
* 'Update', or edit existing entries
* 'Delete', deactivate, or remove existing entries
Because these operations are so fundamental, they are often documented
and described under one comprehensive heading such as "contact
management" or "document management" in general.
Other variations
======================================================================
Other variations of CRUD include:
* ABCD (add, browse, change, delete)
* CRUDL (create, read, update, delete, list)
*BREAD (browse, read, edit, add, delete)
* DAVE (delete, add, view, edit)
* CRAP (create, replicate, append, process)
See also
======================================================================
* Representational state transfer (REST)
* Active record pattern
* Data manipulation language
* Input/output
* ACID
* Query by Example
* Command-query separation
* Scaffold (programming)
License
=========
All content on Gopherpedia comes from Wikipedia, and is licensed under CC-BY-SA
License URL:
http://creativecommons.org/licenses/by-sa/3.0/
Original Article:
http://en.wikipedia.org/wiki/Create,_read,_update_and_delete