A
A
Adel Khalitov2019-02-14 19:07:06
Database design
Adel Khalitov, 2019-02-14 19:07:06

In what structure to store data in the database?

There is a test project (tsrm system).
I do it for practice.
There is no understanding of how to store data.
Conditionally:
There is an object type "Lead", which has properties conditionally: "Name", "Contacts", "Address", "Responsible manager"
The "Lead" has "Deals" (there can be infinite): "Deal 1" , "Deal 2", etc.
I don’t understand how information is stored in the database, in what format, etc. (What literature, introductory article can I read to get an idea?)
Conventionally, my lead looks like this:

lead = {
    id:"someID",
    name: "someName",
    phone: "898989898",
    address: "420021, Kazan",
    manager: "someManager",
    deal: [
        {firstDeal: "someInfo"},
        {secondDeal: "someSecondDeal"}
    ],
}

How to interact with it so that you can constantly conveniently add some records to it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-02-14
@SaveLolliPoP

So leads are one table, managers are a separate table, transactions are also a separate table.
managers are attached to leads by ID (in the lead table in the manager field - its ID)
in the deals table there is a lead field in which the lead ID. If the field has an identifier from another table, then the field name = 'tablename_id' to make it clear what that data is.
id in any table is the primary key .
You can also read about a foreign key - a handy feature - it won't let you delete a lead as long as there are deals that refer to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question