Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Aggregate Queries

Author  Topic 

Mnelson
Starting Member

1 Post

Posted - 2012-04-12 : 11:41:12
Hello, Im using db2 and am very new to it. Im trying to execute these queries but im having 0 luck. Im new to SQL and have never really worked with Aggregates.Here is my Library Table Schema

Cardholder
borrowerid b_name b_addr b_status

Reserves
borrowerid isbn r_date

Status
b_status loan_limit

Book
isbn author title pub_name pub_date c_price

Copy
accession_no isbn p_price

Borrows
borrowerid accession_no l_date

Heres what Im trying to do:

1) Find the cardholder (b_name, b_addr) who has borrowed the oldest book in the library.


2) Did people of 'junior' status borrow more books than people of 'senior' status? In general, which of the various statuses has cardhodlers who have borrowed the most books? Answer this question by finding how many books the people of each status actually borrowed.


3) For each cardholder (b_name, b_addr) find the average current price of all the books (not copies) they have either borrowed or reserved.

I just dont even know where to start with these types of queries. Any help would be appreciated!

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-04-12 : 12:33:21
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Fc0000757.htm
Go to Top of Page
   

- Advertisement -