title: Query to display the department names manager department name
body: <p>I have to write a query to display Worker Department and its Manager Department from a table.</p>
  <p>A Department cannot manage itself and all the departments should be displayed once with its Manager department.</p>
  <p>This is the schema of the  Employee and  Department tables:</p>
  <pre><code>Employees:
  
  empno char[6]
  
  firstname varchar[12]
  
  lastname varchar[15]
  
  workdept char[3]
  
  job char[9]
  
  </code></pre>
  <pre><code>Department:
  
  deptno char[3]
  
  deptname varchar[36]
  
  mgrno char[6]
  
  admrdept char [3]
  
  location char[16]
  </code></pre>
  <p>Am I missing something because I cant seem to do it.</p>
  <p>This is the output I am expecting (Worker dept. and Manager Dept. are aliases):</p>
  <pre><code>Worker Dept.                            Manager Dept.
  Administration Systems                  Development Center
  Development Center                      Spiffy Computer Service
  Information Center                      Spiffy Computer Service
  Manufacturing Systems                   Development Center
  Planning                                Spiffy Computer Service Div
  Support Services                        Spiffy Computer Service Div
  </code></pre>
  <p>I have tried this but I cant get the manager Dept.:</p>
  <pre><code>SELECT distinct d.deptname,  d.location , d.admrdept  
  FROM Department d 
  JOIN Employee e on d.deptno = workdept 
  </code></pre>
  <p>PS: I am getting the 3rd column as the dept. code according to the above query, how do I make the connection to the dept name.</p>