Restaurant Database Schema

A model for a restaurant or food-ordering product. Menu items belong to a menu, customers seated at a dining table place orders, and each order collects line items drawn from the menu. The same structure powers POS systems, food-delivery apps, and cafe ordering kiosks.

Open in editor → 5 tables · MySQL DDL

Tables in this schema

menusmenu_itemsdining_tablesordersorder_items

Schema (SQL)

MySQL-dialect DDL. Open it in the editor for a visual ER diagram you can edit, or copy the SQL straight into your project.

CREATE TABLE menus (
  id INT PRIMARY KEY AUTO_INCREMENT,
  name VARCHAR(100) NOT NULL,
  active BOOLEAN NOT NULL DEFAULT TRUE
);

CREATE TABLE menu_items (
  id INT PRIMARY KEY AUTO_INCREMENT,
  menu_id INT NOT NULL,
  name VARCHAR(150) NOT NULL,
  description VARCHAR(255),
  price DECIMAL(10,2) NOT NULL,
  is_available BOOLEAN NOT NULL DEFAULT TRUE,
  FOREIGN KEY (menu_id) REFERENCES menus(id)
);

CREATE TABLE dining_tables (
  id INT PRIMARY KEY AUTO_INCREMENT,
  label VARCHAR(20) NOT NULL UNIQUE,
  seats INT NOT NULL
);

CREATE TABLE orders (
  id INT PRIMARY KEY AUTO_INCREMENT,
  table_id INT NOT NULL,
  status VARCHAR(20) NOT NULL,
  total DECIMAL(12,2) NOT NULL,
  placed_at DATETIME NOT NULL,
  FOREIGN KEY (table_id) REFERENCES dining_tables(id)
);

CREATE TABLE order_items (
  id INT PRIMARY KEY AUTO_INCREMENT,
  order_id INT NOT NULL,
  menu_item_id INT NOT NULL,
  quantity INT NOT NULL,
  unit_price DECIMAL(10,2) NOT NULL,
  notes VARCHAR(200),
  FOREIGN KEY (order_id) REFERENCES orders(id),
  FOREIGN KEY (menu_item_id) REFERENCES menu_items(id)
);