S
S
ssrdop2019-01-15 17:08:36
Database design
ssrdop, 2019-01-15 17:08:36

How to store accounts in the database?

There are different types of organizations in the program that I am writing (budgetary, commercial, and so on). Each of these organizations has accounts. For example, any commercial organization has an account consisting of accounts with numbers (01, 02, 08, 10 ...), for a budget organization (302/11, 105, 508 ...). That is, the type of organization directly affects the list of accounts.
Question in the following - how it is correct to store these accounts in base?
(1) (for example, for a commercial org, the table will have columns): organization_id, n_01, n_02, n_08 ....
(2) (Or only three columns) organization_id, check_name, value
Which option is preferred? If according to the first option, then each type of organization will have its own table with accounts and, accordingly, a different number of fields. According to the second option, it seems to me that there will be a large volume, and the question is about data integrity, that is, they forgot to create a field with a certain number.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2019-01-15
@SERGIUSH_UA

Don't forget about sub-accounts. This is an account of type "62.1.3". As if for this account there is a parent "62.1", and for that, respectively, "62". Hierarchy of accounts. As a result, a hierarchical structure will suit you. Google is full of information about it. For example: am.rusimport.ru/MSAccess/topic.aspx?ID=321 or am.rusimport.ru/MSAccess/topic.aspx?ID=463

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question