• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 5 pages
Other

CRUD Operations: Managing Data in Databases

Document preview thumbnail
Preview 2 out of 5 pages

This document explains CRUD operations—Create, Read, Update, and Delete—which are the fundamental actions for managing data in databases. It covers how these operations work in both SQL and NoSQL databases with examples of SQL queries and NoSQL commands.

Content preview

CRUD Operations
1. Introduction to CRUD
CRUD operations are the fundamental functions for working with persistent data
in any database system, including relational (SQL) and non-relational (NoSQL)
databases. These operations correspond to the basic actions that allow users to
create, read, update, and delete data.



2. CRUD Operations Breakdown
a. CREATE (C)

 Purpose: The CREATE operation is used to insert new records into a
database.
 In SQL, the INSERT statement is used for this operation.
 In NoSQL, it varies depending on the type of database (e.g., insert() in
MongoDB).

SQL Example:

INSERT INTO Employees (ID, Name, Age, Department)
VALUES (1, 'Alice', 30, 'HR');

NoSQL Example (MongoDB):

db.employees.insertOne({
ID: 1,
Name: "Alice",
Age: 30,
Department: "HR"
});

, b. READ (R)

 Purpose: The READ operation is used to retrieve data from a database.
 In SQL, the SELECT statement is used to retrieve data.
 In NoSQL, it varies based on the database type (e.g., find() in MongoDB).

SQL Example:

SELECT Name, Age, Department
FROM Employees
WHERE Department = 'HR';

NoSQL Example (MongoDB):

db.employees.find({ Department: "HR" });


c. UPDATE (U)

 Purpose: The UPDATE operation is used to modify existing records in a
database.
 In SQL, the UPDATE statement is used for this operation.
 In NoSQL, it varies based on the database (e.g., updateOne() in MongoDB).

SQL Example:

UPDATE Employees
SET Age = 31
WHERE ID = 1;

NoSQL Example (MongoDB):

db.employees.updateOne(
{ ID: 1 },
{ $set: { Age: 31 } }
);

Document information

Uploaded on
January 30, 2025
Number of pages
5
Written in
2024/2025
Type
Other
Person
Unknown
$5.29

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
252
Last sold
-




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions