How many years was John III the King of Portugal and the Algarves for?
return John III was  the  King of Portugal and  the Algarves ;return years of #1 ;return number of  #2
['select', 'project', 'aggregate']