-
Customers
- customer_id — unique identifier, primary key
- name
- address
- contact
-
Combos
- combo_id — unique identifier, primary key
- name
- price
-
Orders
- order_id — unique identifier, primary key
- customer_id — foreign key to customers(customer_id)
- combo_id — foreign key to combos(combo_id)
- order_time

- IDs: INT with
AUTO_INCREMENTfor simple unique identifiers. - Names:
VARCHAR(100)— variable length and index-friendly. - Address:
TEXT— can be long and is rarely filtered by equality. - Price:
DECIMAL— exact storage for currency, e.g.,DECIMAL(4,2). - Order time:
DATETIME. - Contact:
VARCHAR(20)— phone numbers stored as strings.
Store phone numbers as
VARCHAR because they may include leading zeros, country codes, plus signs, or formatting characters (dashes, spaces, parentheses). Numeric types will drop leading zeros and lose formatting.- One customer can place zero or many orders (1:N).
- One combo can appear in zero or many orders (1:N).
- Each order belongs to exactly one customer and one combo.
- No separate join table is necessary — the orders table models the association.

Foreign key constraints require a storage engine that supports them (e.g., InnoDB). If you get errors creating FKs, ensure your tables use
ENGINE=InnoDB or the server default supports foreign keys.orders.customer_id and orders.combo_id are foreign keys, every row in orders must reference existing rows in customers and combos. This prevents orphaned references and keeps your data consistent.
Reading the data
A simple SELECT on the orders table shows only IDs and FK references:
VARCHAR for phone numbers, DECIMAL for currency, and DATETIME for timestamps.
Consider these extensions to make the model more production-ready:
- Add indexes on frequently queried columns (e.g.,
customers(name),orders(order_time)). - Add
order_status,delivery_instructions, ordelivery_addresstoorders. - Normalize or denormalize further depending on read/write patterns.
- Add constraints for data quality (e.g.,
CHECKonprice >= 0).
- MySQL Documentation: https://dev.mysql.com/doc/
- MySQL CREATE TABLE: https://dev.mysql.com/doc/refman/en/create-table.html
- DECIMAL type details: https://dev.mysql.com/doc/refman/en/precision-math.html