title: sql- how to get min,max,ave after inner join with groupby column?
body: <p>I am trying to get min, max, avg value in a column after <code>group by</code> based on another column.</p>
  <p>From what I saw here:<a href="https://stackoverflow.com/questions/68798414/sql-get-min-and-max-with-inner-join">SQL Get MIN() and MAX() with INNER JOIN</a></p>
  <p>my syntax is correct so I am not sure what the problem is.</p>
  <p>But I'm getting this error:</p>
  <blockquote>
  <p>You can only execute one statement at a time.</p>
  </blockquote>
  <p>The code is :</p>
  <pre><code>import sqlite3
  import pandas as pd
  battles=pd.read_csv('https://github.com/TheMLGuy/Game-of-Thrones-Dataset/raw/master/battles.csv')
  character_deaths=pd.read_csv('https://github.com/TheMLGuy/Game-of-Thrones-Dataset/raw/master/character-deaths.csv')
  character_predictions=pd.read_csv('https://github.com/TheMLGuy/Game-of-Thrones-Dataset/raw/master/character-predictions.csv')
  
  character_deaths.loc[:,'Book_of_Death']=character_deaths.loc[:,'Book of Death']
  
  cnx = sqlite3.connect('pythonsqlite.db')
  battles.to_sql(name='battles', con=cnx, if_exists='replace')
  character_deaths.to_sql(name='character_deaths', con=cnx, if_exists='replace')
  character_predictions.to_sql(name='character_predictions', con=cnx, if_exists='replace')
  
  
  #Edit the query
  qry=&quot;&quot;&quot;
  --&lt;&lt;&lt;write your query below this line&gt;&gt;&gt;
  
  SELECT MIN(character_predictions.age) as 
  min_age,MAX(character_predictions.age) as 
  max_age,AVG(character_predictions.age) as ave_age
  FROM character_predictions
  INNER JOIN character_deaths ON 
  character_predictions.name = character_deaths.Name;
  GROUP BY character_deaths.Book_of_Death
  &quot;&quot;&quot;
  
  pd.read_sql(qry, con=cnx)
  </code></pre>
  <p>and what I want to get is avg, min, max of 'age' column for each book (that's why I do the <code>group by</code>..)</p>