title: MYSQL: covert a table of IDs into a table of names
body: <p>Can someone help me on this SQL practice? </p>
  
  <p><strong>Movie ( mID, title, year, director )</strong> 
  Definition: There is a movie with ID number mID, a title, a release year, and a director. </p>
  
  <p><strong>Reviewer ( rID, name )</strong> 
  Definition: The reviewer with ID number rID has a certain name. </p>
  
  <p><strong>Rating ( rID, mID, stars, ratingDate )</strong> 
  Definition: The reviewer rID gave the movie mID a number of stars rating (1-5) on a certain ratingDate. </p>
  
  <p>For all pairs of reviewers such that both reviewers gave a rating to the same movie, return the names of both reviewers. Eliminate duplicates, don't pair reviewers with themselves, and include each pair only once. For each pair, return the names in the pair in alphabetical order. </p>
  
  <hr>
  
  <p>I wrote following query to get pairs of reviewers' ID, but was struggled to get an efficient way to get both reviewers' names in a table: <br></p>
  
  <pre><code>select distinct r1.rID as rID1, r2.rID as rID2
  from Rating r1, Rating r2
  where r1.rID &lt; r2.rID
  and r1.mID = r2.mID;
  </code></pre>