Sample Database Structure for a Basic Ecommerce Website

Mandeep Singh
Mar 31, 2023
Photo by Roberto Cortese on Unsplash

an example database structure for a simple ecommerce website.

Here’s a basic schema to get you started:

Users Table

  • id (primary key)
  • name
  • email
  • password
  • address
  • phone_number

Products Table

  • id (primary key)
  • name
  • description
  • image
  • price
  • category_id (foreign key referencing Categories Table)

Categories Table

  • id (primary key)
  • name

Orders Table

  • id (primary key)
  • user_id (foreign key referencing Users Table)
  • order_date
  • status (e.g. pending, shipped, delivered)

Order Items Table

  • id (primary key)
  • order_id (foreign key referencing Orders Table)
  • product_id (foreign key referencing Products Table)
  • quantity
  • price

This is a simple example schema that includes tables for users, products, categories, orders, and order items. You can modify and expand this structure to fit the needs of your ecommerce website.

--

--