Scenario: In a social media platform, users can follow other users. However, a user cannot follow themselves. How would you enforce this constraint in the database?
- Check Constraint
- Foreign Key Constraint
- Primary Key Constraint
- Unique Constraint
To prevent a user from following themselves on a social media platform, you would use a Check Constraint. This constraint allows you to specify a condition, ensuring that the value in the follow relationship does not match the user's own ID.
Loading...
Related Quiz
- How does the concept of slowly changing dimensions (SCD) relate to fact tables?
- Scenario: A social media platform stores user posts, comments, and interactions in its database. Users frequently search for posts by keyword, user ID, or time period. How would you implement indexing to facilitate efficient searching in this scenario?
- What is the advantage of using compression techniques in data storage systems?
- How does SQL handle data manipulation compared to UML?
- What type of data format is commonly used for documents in document-based modeling?