Hi,
I am trying to understand MySQL as i am new to this and i have a few queries I am having problems with and I was wondering if anyone can help me with it.. How would you solve this problem using the Select, from, where etc commands.
For example if you were to Find out what the average cost of all the books in a book table is, how would you write it.. and also how to find out which book cost the MOST in a book table, how would you write it.. I have tried to write what i have thought but its not giving me any answer at all.. I am using MySQL query.. Thank you so much in advance for your help
You should be using the avg and max functions.
So to get the average price
select avg(price) from books;
or the most expensive
select title, max(price) from books group by title order by max desc
/you may need to alter these slightly for mysql - i use postgresql these days