You're designing a database schema for a social media platform. How would you structure the tables to efficiently handle user profiles and their relationships?

  • Separate tables for users, profiles, relationships; Use foreign keys to link tables
  • Single table for users with profile details as columns; Use triggers for relationships
  • Hierarchical structure with nested tables for profiles and relationships
  • Use denormalization for faster access
Option 1 is correct. In a social media platform, it's efficient to have separate tables for users, profiles, and relationships. This allows for easier management and scalability. Foreign keys ensure data integrity and help in querying related information efficiently. Using a single table for users can lead to data redundancy and maintenance issues. A hierarchical structure may become complex and harder to manage as the platform scales. Denormalization, while useful in certain cases, may not be ideal for handling user profiles and relationships in a social media context.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *