Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

72
Views
Prisma client select all rows from a table

how can I select everything from a table with prisma? (SELECT * FROM application)

const applications = prisma.application.findMany({
        // Returns all user fields
        include: {
            posts: {
                select: {
                    age: true,
                    about_section: true,
                    user_id: true
                },
            },
        },
    })
    console.log(applications.age)

Here is how my schema looks:

model application {
  application_id Int     @id @default(autoincrement())
  age            String? @db.VarChar(255)
  about_section  String? @db.VarChar(255)
  user_id        Int?
  users          users?  @relation(fields: [user_id], references: [user_id], onDelete: Restrict, onUpdate: Restrict, map: "application_ibfk_1")

  @@index([user_id], map: "user_id")
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

For rows, findMany() without where will return all rows in table:

Get all Records
The following findMany query returns all User records:

const users = await prisma.user.findMany()

For columns/fields, without specifying include or select, prisma has a default:

By default, when a query returns records (as opposed to a count), the result includes the default selection set:

  • All scalar fields defined in the Prisma schema (including enums)
  • None of the relations

For SELECT * FROM application (does not include users relation):

const applications = await prisma.application.findMany();

To futher include users relation in the model:

const applications = await prisma.application.findMany({
  include: {
    users: true // will include all fields
  }
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!