Aggregate function problem 15

   Aggregate function problem





1) Show sum of all amount in loan table 

     SQL query: select sum(amount) from loan




2) Show average of all amount in loan table 

     SQL query: select avg(amount) from loan



3) Show maximum  amount in loan table 

     SQL query: select max(amount) from loan



4)  Show minimum amount in loan table 

     SQL query: select min(amount) from loan



5) Show how many loan_number have in loan table 

     SQL query: select count( loan_number ) from loan



6) List of the number of loan_number in each branch

     SQL query: select count( loan_number ), branch_name  from loan group by branch_name  



7) Show sum of all amount in loan table where amount greater than 1200 tk

     SQL query: select sum(amount) from loan where amount > 1200



8)  Show how many loan_number have in loan table where branch name is " Downtown "

     SQL query: select count( loan_number ) from loan where branch_name = ' Downtown  '




9) List of the maximum amount in each branch from loan table?

     SQL query: select max( amount), branch_name  from loan group by branch_name  




10)  List of the minimum amount in each branch from loan table?

     SQL query: select min( amount), branch_name  from loan group by branch_name  




11) Show maximum & minimum && average balance in " Downtown " branch

     SQL query: select min( amount), max( amount), avg( amount)  from loan where branch_name =   ' Downtown  '  




12) Show total amount from loan table where amount greater than 1500 tk ?

      SQL query: select sum( amount) from loan where amount > 1500.




13) Show total amount from loan table where amount less than 2000 tk ?

      SQL query: select sum( amount) from loan where amount < 2000.



14) Show total loan number from loan table where amount less than 2000 tk ?

      SQL query: select count( loan_number) from loan where amount < 2000.




15) Show total loan number from loan table where amount greater than 2000 tk ?

      SQL query: select count( loan_number) from loan where amount > 2000.







Post a Comment

0 Comments