1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Is This ER Diagram for a Social Media Application Properly Normalized and Correctly...

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 8, 2024 às 09:23.

  1. Stack

    Stack Membro Participativo

    I’ve been learning SQL for about a month now, and I want to showcase what I’ve learned by creating a proper database schema and ER diagram. I’ve chosen to design a simple social media application database, where users can connect with others through real-life meetings.

    After reviewing the ER diagram, I believe it’s properly normalized and uses correct cardinality. However, I’m still not an expert, and I’d appreciate the opinion of someone with more experience in the field to properly check its correctness.

    My biggest questions are:


    1. Is the recursive relationship for friendships correct?
      I’ve set up the relationship between user_id and user_friend_id to show that both values come from the same table, representing a user’s friendship connections. Is this the right way to represent a recursive relationship?


    2. Is the user_own_communities relationship properly defined?
      The idea is that a user may not own any communities, but for a community to exist, it must be owned by at least one user. I plan to add a trigger when creating the schema to ensure that when a community is created, it must have at least one owner associated with it. Does this approach seem appropriate?


    3. Should I add text annotations between the tables to better explain the relationships?
      My concern is that I’m not sure what type of text to place between junction tables. Is it okay to have relationship lines with text for some tables, and no text for others?


    4. What’s the best way to present an ER diagram?
      I’ve just taken a screenshot of the diagram, but I’m wondering if that’s the best way to share it. Should I provide a link to the diagram management website so that others—like future colleagues or employers—could explore the diagram in more detail?


    5. Should I use bold text for the rows that must not be NULL?
      I've read that it's a good practice, but I'm not sure about it.

    Thanks in advance for your time and feedback!

    [​IMG]

    Continue reading...

Compartilhe esta Página