There is a DB users . In one of the tables there are fields login , password , id . How to link multiple users? Those. user with login Вася is Алексея friend? And the user Петр has, for example, 14 friends ( Леша , Вася , Катя ..).

What tables do you need? How to organize, i.e. How to make connections between them?

DB - MySQL.

How are large amounts of data in a database structured? For example, like in social networks, user Олег has hobbies 1,2 and 3, participates in groups number 32, 43, 65, and also has personal photos, videos, and audio.

What to study to understand how this is done correctly? If you know the manuals on this issue - tell me, I will be grateful.

    1 answer 1

    Explore three types of relationships:

    • one to one
    • one to many
    • many to many

    There is a lot of information in the network. There are examples of both tables and queries. Here is one of the options https://habrahabr.ru/post/193380/

    To store the graph of friends it is better to use the graph database (neo4j). Since using a relational database (MySql) for this purpose is not as effective.