For 2024, I’m trying something new: weekly homework challenges! For this week, let’s say we’ve decided to implement foreign keys, and we need to find data that’s going to violate our desired keys.
We’re going to use the Stack Overflow database, and we’ll focus on these 3 tables:
dbo.Users table: with Id column as its primary key dbo.Posts table: with OwnerUserId column noting which Users.Id wrote the post dbo.Comments table: with UserId column noting which Users.Id wrote the comment, and PostId column noting which Posts.Id is being commented on
Before we attempt to implement foreign keys, we need