DataBase_Midterm

Tables (4)

Categories

  • category_id — INT — Primary key — NOT NULL
  • name — VARCHAR(30) — NOT NULL

ChatMessages

  • message_id — INT — Primary key — NOT NULL
  • item_id — INT — Foreign key → Items.item_id — NOT NULL
  • sender_id (user_id) — INT — Foreign key → Items.seller_id — NOT NULL
  • message_text — TEXT — NOT NULL
  • sent_at — DATETIME — NOT NULL

Items

  • item_id — INT — Primary key — NOT NULL
  • seller_id (user_id) — INT — Foreign key → Users.user_id — NOT NULL
  • category_id — INT — Foreign key → Categories.category_id — NOT NULL
  • title — VARCHAR(100) — NOT NULL
  • price — INT — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • posted_at — DATETIME — NOT NULL

Users

  • user_id — INT — Primary key — NOT NULL
  • username — VARCHAR(50) — NOT NULL
  • region — VARCHAR(50) — NOT NULL
  • created_at — DATETIME — NOT NULL