•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 391,912 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,662 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1566 | Replies: 2
![]() |
•
•
Join Date: Oct 2006
Posts: 88
Reputation:
Rep Power: 2
Solved Threads: 0
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
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
•
•
Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation:
Rep Power: 3
Solved Threads: 31
•
•
•
•
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
Last edited by pty : Feb 19th, 2007 at 10:44 am.
Note to self... pocket cup
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
- test mysql query for no results (PHP)
- Double MySQL Query (PHP)
- Python Tuples and Mysql Query (MySQL)
- Change MySQL Query Timeout Period (MySQL)
- pagination of mysql query results (PHP)
- autogenerated mysql query with javascript (PHP)
- probelm with autogenerated mysql query (PHP)
- problem with autogenerated mysql query (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: SQL Server 2005 version Error Insert command help me
- Next Thread: MySQL a start point for future DBA role


Linear Mode