Tech TutorBangla Web Documentation
Portfolio
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • PostgreSQL Documentation40টি অধ্যায়
প্রযুক্তি নির্বাচন
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Postgres Intro
  • Relational Model
  • Install & Setup
  • Connect psql
  • SELECT basics
  • Data Types
  • Create Table
  • Constraints
  • INSERT / UPDATE / DELETE
  • NULL & COALESCE
  • Schema Design
  • Relationships
  • Joins
  • Joins Advanced
  • Aggregation
  • ORDER / LIMIT
  • String Functions
  • Date Functions
  • Subqueries
  • CTE (WITH)
  • Views
  • Window Functions
  • Transactions
  • Indexes
  • Performance
  • UPSERT
  • JSONB
  • Full-Text Search
  • Triggers
  • Roles & Privileges
  • Backup & Restore
  • Node + PostgreSQL
  • Prisma Intro
  • Prisma Migrations
  • TechShop Schema
  • TechShop Queries
  • TechShop API
  • Best Practices
  • Common Mistakes
  • Interview Questions
  1. Docs
  2. PostgreSQL
  3. TechShop — সম্পূর্ণ schema (শিক্ষার project)
PostgreSQLIntermediate

TechShop — সম্পূর্ণ schema (শিক্ষার project)

আমাদের পুরো ডিজাইন এক নজরে — users ⟫ orders ⟫ items।

4টি অংশবাংলা ভাষায়
CREATE TABLE categories (
  id    bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  name  text NOT NULL UNIQUE
);

CREATE TABLE users (
  id    bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  email text NOT NULL UNIQUE,
  name  text NOT NULL,
  role  text NOT NULL DEFAULT 'customer'
);

CREATE TABLE products (
  id          bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  category_id bigint REFERENCES categories(id),
  name        text NOT NULL,
  price       numeric(10,2) NOT NULL,
  qty         integer NOT NULL DEFAULT 0,
  spec        jsonb
);

CREATE TABLE orders (
  id         bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  user_id    bigint NOT NULL REFERENCES users(id),
  total      numeric(10,2) NOT NULL DEFAULT 0,
  status     text NOT NULL DEFAULT 'pending',
  created_at timestamptz DEFAULT now()
);

CREATE TABLE order_items (
  order_id   bigint NOT NULL REFERENCES orders(id),
  product_id bigint NOT NULL REFERENCES products(id),
  qty        integer NOT NULL,
  price      numeric(10,2) NOT NULL,
  PRIMARY KEY (order_id, product_id)
);

এই schema-তে order_items bridge table — order-এর সঙ্গে product-এর many-to-many। orders.user_id — user-এর সাথে one-to-many।

  • প্রতিটি নন-empty relational column-এ FK + NOT NULL
  • money হিসাব numeric
  • price order_items-এ copy — product-এর দাম বদলালেও ইতিহাস ঠিক থাকে
index এখনই

যেকোনো dropdown/FK-তে index: users(id) auto, orders(user_id) — যেটা JOIN-এ ভারী, এখনই CREATE INDEX দিন।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
আগেরMigrations — schema version controlপরেরTechShop — flagship business queries
Tech Tutor

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

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

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

mdanamolhasan1998@gmail.com