title: INSERT/DELETE examples in a many-to-many relationship
body: <p>I have three tables, Users, Roles, and a junction UserRoles.</p>
  
  <pre><code>Users       UserRoles         Roles
  =======     =============     =========
  UserId      UserId            RoleId
  Username    RoleId            Role
  Firstname   Date
  </code></pre>
  
  <p>My tables are joined like this:</p>
  
  <pre><code>Users.UserId -&gt; UserRoles.UserId
  Roles.RoleId -&gt; UserRoles.RoleId 
  </code></pre>
  
  <p>Basically, what I am looking for is an simple example that shows:</p>
  
  <ol>
  <li>How to INSERT in UserRoles a UserId and a RoleId for a specific Username with a specific Role.</li>
  <li>Delete a role for a specific Username    </li>
  </ol>
  
  <p>I managed to make a simple select on Roles for a specific Username like so:</p>
  
  <pre><code>SELECT 
      dbo.Roles.Role 
  FROM dbo.Roles 
  INNER JOIN dbo.UserRoles 
      ON dbo.Roles.RoleId = dbo.UserRoles.RoleId 
  INNER JOIN dbo.Users 
      ON dbo.UserRoles.UserId = dbo.Users.UserId 
  WHERE (Username = @Username)
  </code></pre>