The first version of my order table had 34 columns. Customer name, customer phone, customer address, product name, product price, quantity, total, delivery fee, and a column called notes that ended up holding everything I forgot to plan for.
It worked for 200 orders. At 2,000 it became a mess. The same customer appeared 14 times with her name spelled three ways. I could not change a price without editing old orders. And the notes column had things like "paid half, balance on delivery, she wants the small size, call before 5pm".
That table taught me more about design than any course. Here is the version I would build now.
Start with the questions, not the screens
Most people design a database by looking at their app screens. A checkout page needs these fields, so the table gets these fields. That is backwards.
Write down the questions the business will ask. Not the screens. Questions like: which customer owes me money? What did I sell most of last month? Which rider delivers the most orders? How many orders come from Instagram? Each question tells you what must be stored separately and what must be linkable.
If nobody will ever ask a question, you probably do not need the column.
I keep a page in every project called questions.md and add to it each time the client asks for a number. Six months later it is the best documentation of the schema I have, and the first place I look when someone wants a new report.
The four tables that carry a small business
Almost every small commerce app I have built runs on four tables: customers, products, orders and order_items.
customers: id, name, phone, email, address, created_at.products: id, name, price_kobo, stock, active, created_at.orders: id, customer_id, status, delivery_fee_kobo, total_kobo, created_at.order_items: id, order_id, product_id, quantity, unit_price_kobo.
That is it. No customer name in orders. No product name in order_items. Just ids pointing to the rows that own the fact.
The rule that fixes most beginner schemas is simple: if you would have to update two rows to change one fact, the fact is stored twice. The customer's phone number belongs in customers. If orders also hold the phone, you now have a maintenance job that will fail quietly.
Order items are the exception people miss. You might think the order can just have a product_id. It cannot, because an order can have five products. So you need a row per product per order. That is what order_items is for, and once you see it, half of database design makes sense.
Money and dates will bite you
Never store money as a float. 0.1 + 0.2 does not equal 0.3 in floating point, and one day your totals will be off by one kobo and a customer will notice. Store the amount in kobo as an integer, or use a decimal column. I use integers and divide by 100 when displaying. It is boring and it never lies.
For dates, store UTC and convert at the edge. If you store local time, one server in another region will quietly shift every timestamp by an hour and your "orders today" report will be wrong.
The status column is a decision, not a detail
Beginners use free text for status and end up with "pending", "Pending", "pend", and "not paid" in the same column. Pick a fixed list and enforce it. In Postgres use an enum or a check constraint. In MySQL use an enum. Values like pending, paid, shipped, delivered, cancelled.
Then write down which transitions are legal. An order can go from pending to paid, but not from cancelled back to paid without a refund record. The database does not need to enforce every rule, but your code should have one place where status changes happen.
Name things like a tired person will read them
Snake case, plural table names, singular column names. order_items, not OrderItems or tbl_oi. A column called created_at on every table saves you an argument later. Avoid names that need explanation: flag2, data, info.
This sounds like style. It is maintenance. Six months from now you will be reading this schema at 11pm, and clear names are the difference between ten minutes and an hour.
Do this today
Open a blank file and write the four tables above in SQL. Create them in SQLite or Postgres. Insert three customers, four products, and two orders with three items between them. Then run one query that returns each order with the customer name and the total. If the query feels easy to write, your design is probably fine.
If you are still deciding on the engine, read SQL versus NoSQL first. Then build a CRUD app on these tables. The software development course walks through the same schema with the queries attached.