SQL Server database design users and events tables relation
<p>I have 2 tables <code>Users</code> and <code>Events</code>.</p>

<p>The <code>Users</code> table stores information about the users: name, email, etc. The <code>Events</code> table has a list of events: registration, password reset, etc etc.</p>

<p>How can I map these two into a new table where I can store history about user activity.</p>

<p>Example user reset password, add a record to a third table called <code>UserEvents</code> for example.</p>

<p>My problem is building this 3'rd table. So if I add to it a composite key userid and eventid, that won't be unique. as an user will reset a password multiple times, and will end up with a composite primary key of same userid and save eventid.</p>

<p>User Table has the following columns:</p>

<ul>
<li>UserId (PK)</li>
<li>Name</li>
<li>Email</li>
</ul>

<p>Event Table has the following columns:</p>

<ul>
<li>EventId (PK)</li>
<li>Name</li>
<li>Description</li>
</ul>

<p>Should the UserEvent table be like this:</p>

<ul>
<li>Id (PK) - generated or identity type</li>
<li>UserId (FK to User table - UserId)</li>
<li>EventId (FK to Event table - EventId)</li>
</ul>

<p>I will use EF7 code first approach.</p>