You are on page 1of 3
BEF FRO BOOM momen - ye VAiw 1 #1. Find the average account balance at the Perryridge branch. 2+ select avg(balance) 3 from account 4 where branch_names'Perryridge' 5 [eso IG wwe Th #2. Find the average account balance at each branch. select branch_name,avg(balance) from account| group by branch_name; | Reet) 9 Fe Rs | ot By swap ccs Teh pane__ orale) ¥ ighen 750 (coms 888 erwee 60 Ronda 30 #3, To eliminate duplicates, use the key distinct in the aggragiate expression select branch_name, avg(distinct balance) ‘Fron/aceount] group by branch_nanes “BEF FROG COM vm: -%¥ ATH {16 #4. Find the numbers of depositers for each branch. 217+ select branch_name, count (customer_name) < 18 from depositor we 19 natural join account 120 group by branch_name; co 21 | Rent Grid |) Prov tase: Oy | wrap cat coments I ‘weere_curdastne pee) = i | | Ee 8 FFLOB COR mmm xiv ans 22° #5. (In this case, a depositor counts only once, ¢ ardiess of the rusber of accounts ia thet deposttor may have) | ane) 24+ select branch_name,count(distinet custom 25. from depositor 26 natural join account 27 group by branch_name; 28 29 #6. Find the branches where the average account balance is more than $1200. 30+ select branch_nane, avg (balance) 31 from account 32. group by branchname 33 having avg (balance) > 38 39 #8. To find the number of tuples in the customer relation: 40+ select count(*) 41 from customer; a2 nt) vis | eee Oy [waren 34 35 #7. Find the average balance for all accounts. 36+ a 37 from account; «Ge 7 TAOS COM mm evans fas 4.44 0/9. Find the average balance for each custoner who Lives in Harrison and “45. | nas at least three accounts.+/ Lass seect avo(batance w= 47 FROM account | 48 natural join customer E49 mere 50 custoner_street = ‘Harrison’ 51 group by customer_name 52 HAVING 53 COUNT(aecount_number) >= 35 sa [nee ll @ rete eee

You might also like