M
M
mukola332016-08-22 12:56:37
Database
mukola33, 2016-08-22 12:56:37

How to design a database schema for “users, tariff. plans, orders?

There are users, there are tariff plans. There are orders, we put the tariff plan in the order. The tariff plan can have different duration - a month, 2, a year, etc.
Also, the order can be paid, unpaid, cancelled...
I'm wondering how can I calculate the user's balance? It - a field balance in the table "user" - is generally necessary? Or is it better to take all the user's orders, take only the paid ones and subtract from them the prices for the tariff plans that this user has bought? Something somehow difficult?
Didn't find anything on google. What is the best way to design all this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artemy, 2016-08-22
@MetaAbstract

It is necessary to create a table with operations on the balance and calculate the balance on it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question