Queries

Select fields

Learn how to return only the fields and relations you need with select and include in Prisma Client.

By default, Prisma Client returns all scalar fields for a model and no relations. Use select and include to make the result smaller, clearer, and more intentional.

Return the default fields

If you do not pass select, include, or omit, Prisma Client returns all scalar fields for the model and excludes relations from the result.

Select specific fields

Use select when you only need a few scalar fields:

const user = await prisma.user.findFirst({
  select: {
    email: true,
    name: true,
  },
});

Return nested objects by selecting relation fields

Use include when you want related records alongside the main result:

const user = await prisma.user.findFirst({
  include: {
    posts: true,
  },
});

Nest selections

You can combine both patterns to keep relation payloads focused:

const user = await prisma.user.findFirst({
  select: {
    email: true,
    posts: {
      select: {
        title: true,
        published: true,
      },
    },
  },
});

Omit fields instead of selecting everything manually

If you mostly want the default result but need to exclude a few fields, see Excluding fields.

On this page