title: What is the solution for this sql complex interview question?
body: <p>I am pretty good at sql.
  I have faced this question in interview and was unable to figure out the answer.</p>
  
  <p>Question:
  There is a <strong>location</strong> table 
  With 3 columns (source, destination, distance)as show below</p>
  
  <p>Location:</p>
  
  <pre><code>Source - Destination - Distance
  Hyderabad - Chennai - 700
  Chennai - Hyderabad - 700
  Hyderabad - Bangalore -650
  </code></pre>
  
  <p>As given above , Hyderabad to Chennai or Chennai to Hyderabad both mean the same as the distance will always be same.</p>
  
  <p>So we need to write the query to so that the output should not have such kind of duplicate records.</p>
  
  <p>In the above case output should be</p>
  
  <p>Location:</p>
  
  <pre><code>Source - Destination - Distance
  Hyderabad - Chennai - 700
  Hyderabad - Bangalore -650
  </code></pre>