Final Answer:
The design of the social media database should include tables for "Users," "Media," and "Views." The "Users" table would store information about individual and company users, while the "Media" table would contain details about posts and stories, including media type, duration, and additional features like GIFs, music, avatar, etc. If the media is of the story type, a mechanism should be in place to automatically delete it after 24 hours. The "Views" table would track the number of views for each media item along with the usernames of the viewers.
Step-by-step explanation:
In the database design, the "Users" table serves as the foundation, capturing essential information about both individual and company users. This includes details such as usernames, account type, and any other relevant user-related information.
The "Media" table plays a crucial role in storing information about the posts and stories shared on the platform. It should include fields for media type (photo or video), duration of media (relevant for story type), and flags to indicate whether additional features like GIFs, music, avatar, emoji, location, person tags, text, surveys, and links are associated with the media.
For story-type media, a mechanism needs to be implemented to automatically delete the media after 24 hours. This could involve a scheduled task or a time-based trigger.
The "Views" table is designed to keep track of user engagement. It stores the number of views for each media item and includes a reference to the usernames of the viewers. This allows the system to provide insights into the popularity of different media among users.
Overall, this database design ensures efficient storage and retrieval of information, catering to the diverse content and user types present in the social media platform described.