Your SlideShare is downloading. ×
Sql group by clause
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Sql group by clause

45

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
45
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 8/10/13 SQL Group ByClause beginner-sql-tutorial.com/sql-group-by-clause.htm 1/1 SQL GROUP BY Clause The SQL GROUP BY Clause is used along with the group functions to retrieve data grouped according to one or more columns. For Example: If you want to know the total amount of salary spent on each department, the query would be: SELECT dept, SUM (salary) FROM employee GROUP BY dept; The output would be like: dept salary ------------- --- --------- ----- Electrical 25000 Electronics 55000 Aeronautics 35000 InfoTech 30000 NOTE: The group by clause should contain all the columns in the select list expect those used along with the group functions. SELECT location, dept, SUM (salary) FROM employee GROUP BY location, dept; The output would be like: location dept salary ------------ - ------------- -- ------- ---- Bangalore Electrical 25000 Bangalore Electronics 55000 Mysore Aeronautics 35000 Mangalore InfoTech 30000

×