title: Query Wikipedia: retrieve links from a category page
body: <p>I am trying to query all the page links of a category page in Wikipedia. 
  It was easy to do it with templates but I am having problems with categories.</p>
  
  <p>I generally log into Wikipedia by ssh at ...@tools-login.wmflabs.org
  and access their mysql database. </p>
  
  <p>For example, for the templates I generally do : </p>
  
  <pre><code>SELECT pl.pl_title
  FROM page p
  JOIN pagelinks pl on p.page_id=pl.pl_from
  WHERE p.page_title='Aviation_accidents_and_incidents_in_2014' AND
        p.page_namespace=10 AND
        pl.pl_namespace=0;
  </code></pre>
  
  <p>this query easily gives me all the page links of this page <a href="https://en.wikipedia.org/wiki/Template:Aviation_accidents_and_incidents_in_2014" rel="nofollow">https://en.wikipedia.org/wiki/Template:Aviation_accidents_and_incidents_in_2014</a></p>
  
  <p>If I want to do the same with the category page <a href="https://en.wikipedia.org/wiki/Category:Aviation_accidents_and_incidents_in_2004" rel="nofollow">https://en.wikipedia.org/wiki/Category:Aviation_accidents_and_incidents_in_2004</a>: </p>
  
  <pre><code>SELECT pl.pl_title
  FROM page p
  JOIN pagelinks pl on p.page_id=pl.pl_from
  WHERE p.page_title='Aviation_accidents_and_incidents_in_2014' AND
        p.page_namespace=14 AND
        pl.pl_namespace=0;
  </code></pre>
  
  <p>It returns nothing. </p>
  
  <p>I have tried other combinations but still can't get it (zero results again).</p>
  
  <pre><code>SELECT pl.pl_title
  FROM category c
  JOIN pagelinks pl on c.cat_id=pl.pl_from
  WHERE c.cat_title='Aviation_accidents_and_incidents_in_2014' AND
        pl.pl_namespace=0;
  </code></pre>
  
  <p>Do you happen to have an example of this?</p>
  
  <p>Any help will be appreciated</p>