November 05, 2018

SQL Where IN Having and Group by Query Sample

customer table



select * from customer where country = 'IN'



select * from customer where country in ('in','us');


select * from customer having country = 'in'




select * from customer GROUP BY country



select customer_name,sum(credit) as balance from customer group by country;



select customer_name,sum(credit) as balance from customer where country in ('in','us','jp');



select customer_name,sum(credit) as balance from customer group by country having balance > 1800;



Thank you..

No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments