Relationships in databases link different entities, showing how they interact or depend on each other, which mirrors real-world connections.
Author has many Book entries, what will this query return?{ author(id: 1) { name books { title } } }type Author { id: ID! name: String! books: [Book!]! } type Book { id: ID! title: String! author: Author! }The query fetches the author with ID 1, including their name and all related books' titles, showing the relationship in action.
Category has many Product items?Option A correctly uses a list of non-nullable Product items in Category and a non-nullable Category in Product, modeling one-to-many.
Users with their Posts causes slow response times. Which approach best improves performance while preserving relationships?Using data loader or batching reduces the number of database calls by grouping requests, improving performance while keeping relationships intact.
Order with related Customer returns null for the customer field, even though the database has the data. What is the most likely cause?query { order(id: 123) { id customer { name } } }If the resolver for a related field is missing or returns null, the field will be null in the response despite data existing in the database.
