Tech TutorBangla Web Documentation
Portfolio
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • PrismaPostgres Documentation40টি অধ্যায়
প্রযুক্তি নির্বাচন
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Prisma Intro
  • Prisma vs Raw SQL
  • Setup & Install
  • Schema Basics
  • Models
  • Relations
  • Migrations
  • Prisma Client
  • Create & Upsert
  • Read Queries
  • Update & Delete
  • Query Filters
  • Sort & Pagination
  • Select & Include
  • Nested Writes
  • Transactions
  • Aggregation
  • JSON Fields
  • Raw SQL
  • TechShop Schema
  • TechShop Seed
  • Relations Advanced
  • Env Config
  • Global Client
  • Next.js + Prisma
  • Express API
  • Error Handling
  • Performance
  • Connection Pool
  • Prisma Studio
  • Deploy Migrations
  • TechShop Indexes
  • TechShop Cart
  • TechShop Stats API
  • Schema Evolution
  • Debugging
  • Common Mistakes
  • Best Practices
  • Interview Questions
  • Recap & Next
  1. Docs
  2. PrismaPostgres
  3. count, aggregate, groupBy
PrismaPostgresIntermediate

count, aggregate, groupBy

পরিসংখ্যান client-API-তেই — ড্যাশবোর্ড বানানো।

4টি অংশবাংলা ভাষায়
const total = await prisma.product.count({
  where: { active: true },
});

const stats = await prisma.order.aggregate({
  where: { status: "paid" },
  _count: true,
  _sum: { total: true },
  _avg: { total: true },
  _max: { created_at: true },
});
groupBy — category-wisets
ts
const byCategory = await prisma.product.groupBy({
  by: ["categoryId"],
  _sum: { price: true },
  _count: true,
  orderBy: { _count: { categoryId: "desc" } },
});

groupBy-এ by বাধ্যতামূলক — তারপর _sum/_avg ইত্যাদি। orderBy/having ঘুরে-ফিরে যায় post-aggregation।

HAVING-equivalent

Prisma-তে groupBy-এর having: { _sum: { total: { gte: ... } } } — SQL HAVING-এর সাথে মেলে।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
আগের$transaction — সব-or-নাতথাক ATOMICITYপরেরJson scalar — flexible data (spec)
Tech Tutor

বাংলায় ওয়েব ডেভেলপমেন্ট ডকুমেন্টেশন শিখুন — ধাপে ধাপে।

Homeসব ডকুমেন্টেশনQuick Startআমার নোটস

© 2026 Tech Tutor. বাংলায় শিখুন, বাংলায় গড়ুন।

mdanamolhasan1998@gmail.com