CRUD Operations in Prisma

From the Prisma ORM cheat sheet · Prisma Client Queries · verified Jul 2026

CRUD Operations

Create, read, update, and delete records using Prisma Client methods

typescript
import { PrismaClient } from './generated/prisma/client'
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })

// CREATE
const user = await prisma.user.create({
  data: {
    email: 'john@example.com',
    name: 'John Doe',
    posts: {
      create: { title: 'My First Post' }
    }
  }
})

// READ
const users = await prisma.user.findMany({
  where: { email: { contains: 'example' } },
  include: { posts: true }
})

// UPDATE
const updatedUser = await prisma.user.update({
  where: { id: 1 },
  data: { name: 'Jane Doe' }
})

// DELETE
await prisma.user.delete({ where: { id: 1 } })
💡 All operations return Promises
⚡ Use select to fetch only needed fields
📌 Include relations with include or select
✅ findUnique requires unique fields

More Prisma tasks

Back to the full Prisma ORM cheat sheet