PCafe ERD

Tables (6)

cart

  • cart_id — INT — Primary key — NOT NULL
  • user_id — VARCHAR(20) — Foreign key → member.user_id — NOT NULL
  • item_id — INT — Foreign key → item.item_id — NOT NULL
  • qty — INT — NOT NULL

category

  • category_id — INT — Primary key — NOT NULL
  • category_name — VARCHAR(50) — NOT NULL

item

  • item_id — INT — Primary key — NOT NULL
  • item_code — VARCHAR(15) — NOT NULL
  • item_name — VARCHAR(50) — NOT NULL
  • price — INT — NOT NULL
  • category_id — INT — Foreign key → category.category_id — NOT NULL

member

  • user_id — VARCHAR(20)
  • user_pw — CHAR(4) — NOT NULL
  • user_name — VARCHAR(20) — NOT NULL
  • is_admin — CHAR(1) — NOT NULL
  • created_at — TIMESTAMP

order_detail

  • order_detail_id — INT — Primary key — NOT NULL
  • order_id — INT — Foreign key → orders.order_id — NOT NULL
  • item_id — INT — Foreign key → item.item_id — NOT NULL
  • unit_price — INT — NOT NULL
  • qty — INT — NOT NULL

orders

  • order_id — INT
  • order_date — DATETIME — NOT NULL
  • user_id — VARCHAR(30) — Foreign key → member.user_id — NOT NULL
  • status — VARCHAR(20)
  • total_amount — INT — NOT NULL