How it works
An ORM maps tables to classes or types, so user.posts can fetch a user's posts and a save call writes changes back. Most also manage migrations and give typed results. Examples: Prisma and Drizzle in TypeScript, SQLAlchemy and Django's ORM in Python, Hibernate in Java, Room on Android.
The convenience has a cost: generated queries can be slow or wasteful (the classic N+1 problem, one query per item in a list), and complex reports are often easier in plain SQL. Query builders sit in between, keeping the shape of SQL with type safety.
Related terms
More in Databases and storage
Talking to a database