Given a Prisma model User with fields id, name, and age, what will this GraphQL query return?
query {
users(where: { age: { gt: 30 } }) {
id
name
}
}model User {
id Int @id @default(autoincrement())
name String
age Int
}Think about filtering users older than 30.
The query filters users where age is greater than 30, returning their id and name. Only Alice and Charlie match.
Choose the correct Prisma schema snippet that defines a Post model with a relation to User via authorId.
Relations require specifying both fields and references.
Option A correctly defines the relation with @relation(fields: [authorId], references: [id]). Others miss references or have syntax errors.
You want to fetch all posts with their authors' names efficiently. Which Prisma client query is best?
Including related data avoids extra queries.
Option A uses include to fetch posts with author data in one query, improving efficiency.
Given this mutation, what error will occur?
mutation {
createUser(data: { name: "Eve", age: "twenty" }) {
id
name
}
}Check the data types in the mutation.
The age field expects an integer, but a string "twenty" is provided, causing a type error.
Choose the most accurate description of how Prisma works with GraphQL.
Think about Prisma's function between your database and GraphQL server.
Prisma is an ORM that helps translate GraphQL queries into efficient database commands, making backend development easier.