title: Fetching non-null values with column names in SQL
body: <p>My table - students is of the form</p>
  
  <pre><code>               Student    Subject1   Subject2
                 A          123         1
                 B                      4
                 C          122         
  </code></pre>
  
  <p>I want to fetch all the non-empty records of a Student along with column names
  Note:Only non-empty records should be displayed</p>
  
  <p>so when I query for student A I should get </p>
  
  <pre><code>          Subject1 123               
            Subject2 1
  </code></pre>
  
  <p>when I query for student B I should get</p>
  
  <pre><code>          Subject2 4
  </code></pre>
  
  <p>when I query for student C I should get 
                Subject1 122</p>
  
  <p>I want to generate the column names dynamically.
  Thanks for the help!</p>