CRUD Operations with Prisma
Explore how to use PrismaClient methods to implement CRUD operations in TypeScript for Node.js. Understand creating, reading, updating, and deleting database records including filtering and batch updates to manage backend data efficiently.
CRUD operations are an important building block of back-end applications. They allow us to Create, Read, Update and Delete data, usually from a database or data structure.
Create
To create a new record in the database, we use the create method in the PrismaClient class.
The data key in the create method maps to the model that we created earlier.
...
model employee {
id Int @default(autoincrement()) @id
email String @unique
name String?
}
Read
To retrieve data from the database, we have ...