Aggregating Data using Group Functions
Identify the available group functions
- AVG - average of value for a group of rows
select ave(pay) from payroll;
- COUNT - count rows of columns
- FIRST - returns the row ranked first using DENSE_RANK
SELECT department_id,
MIN(salary) KEEP (DENSE_RANK FIRST ORDER BY commission_pct) WORST,
MAX(salary) KEEP (DENSE_RANK LAST ORDER BY commission_pct)
BEST
FROM employees
GROUP BY department_id;
- LAST - returns the row ranked last using DENSE_RANK
- MAX - Maximum of all value for groups of rows
- MIN - Minimum of all values for groups of rows
- STDDEV - Sample standard deviation of an expression STDDEV(<expression>)
SELECT STDDEV(salary) DEVIATION FROM employees;
- SUM - Sum of all values for groups of rows
- VARIANCE - variance of an expression
VARIANCE(>value<)
select variance(initial_extent) from users;
Use group functions
Group functions return a single result based on many rows, as opposed to single-row functions.e.g The group COUNT function returns the number of rows returned. These functions are valid in the select list of a query and the GROUP BY clause ONLY.
Most functions can accept qualifiers as their arguments . These qualifiers are DISTINCT and ALL . If the DISTINCT qualifier is passed, then only distinct values returned by the query are considered. The ALL qualifier causes the function to consider all of the values returned by the query. If none is specified then ALL is the default.
Group data using the GROUP BY clause
select last_name, count(roles) from users group by last_name;
select name, count(sales) from customers group by name;
select cars, avg(cost) "Total" from my_cars group by cars having avg(cost) > 10000;
Include or exclude grouped rows by using the HAVING clause
select model from cars group by model having color='blue';
select * from users group by age having age > 35;
home |
archives |
about me |
faq |
my resume |
you tube |
pics |
site map |
More...
ASP.Net |
Get State By Zip Code, VB.Net |
Editing an XML Document, VB.Net |
Accessing an XML Document, VB.Net |
Salary Bi-Directional Scrollable DataGrid C# |
State Bi-Directional Scrollable DataGrid C# |
IEWebControls - Microsoft's Way |
IEWebControls - My Way |
IEWebControls - MultiPage |
Multipage code |
IE WebControls - TabStrip |
TabStrip |
IEWebControls - Toolbar |
Toolbar code |
IEWebControls - Treeview |
Treeview code |
IEWebControls - Treeview Bound |
Treeview Bound code |
IEWebControls - Tree |
Tree code |
Fibonacci Numbers Demo |
Magic Numbers Demo |
Toolbar XML |
Toolbar XSL |
JavaScript |
Dynamic Form Size Counter |
Interest Calculator |
Get the Browser Type |
Cascading Menus |
More Cascading Menus |
Change Fonts through JavaScript and CSS |
JavaScript Dynamic Clock |
Copy Radio Button value to a Textbox |
JavaScript Dropdown State Textbox Search |
JavaScript Last Updated the Document |
Dynamic JavaScript Date Dropdown box |
JavaScript Code Decryptor Encryptor |
JavaScript Code Decryptor Encryptor |
Dynamic Form Field Character Size Checker set at 2000 varchar |
JavaScript MouseOver Hidden Messages |
JavaScript Dropdown list Search: value sent to QueryString |
JavaScript DDL Values Listbox to Listbox: IE, Moz |
JavaScript Country Filter Dropdown list Search form with Regular Expressions |
Scrolling JavaScript Marquee |
Another Calculator |
JavaScript Form Validation with Regular Expressions: complete |
JavaScript Link Selector from a Dropdown Menu |
Nice Dynamic Javascript Panels for searching and so forth |
JavaScript Dynamic Table Sorter |
JavaScript / HTML / HTML Component Text Highlighter for Internet Explorer and Gecko aka Mozill Firefox, AOL, and Netscape |
sql |
Normalization |
First Normal Form |
Second Normal Form |
Third Normal Form |
Fourth and Fifth Normal Form |
Inner Join |
Outer Join |
SQL Server 2000 versus Access 2002 |
Stored Procedure |
oracle |
Basic SQL Select |
Execute SELECT statement |
SQL statements and iSQL*Plus |
Restricting and Sorting Data |
Limit the rows |
Sort the rows retrieved by a query |
Single-Row Functions |
Various SQL Functions |
Character, number, and Date functions |
Use conversion functions |
Displaying Data from Multiple Tables |
Write SELECT statements to access data from more than one table using equality and nonequality joins |
View data Outer Joins |
Join a table to itself |
Aggregating Data |
Identify Group Functions |
Use Group Functions |
Group data GROUP BY |
HAVING clause |
Subqueries |
Problems that subqueries can solve |
Define subqueries |
List the types of subqueries |
Write single-row and multiple-row subqueries |
Output with iSQL*Plus |
Substitution Variable |
Readable output |
Create and execute script files |
Manipulating Data |
Describe each DML statement |
Insert rows into a table |
Update rows in a table |
Delete rows from a table |
Merge rows in a table |
Control transactions |
Creating and Managing Tables |
Main database objects |
Create tables |
Datatypes specifying column definition |
Alter table definitions |
Drop, rename and truncate tables |
Including Constraints |
Describe constraints |
Create and maintain constraints |
Creating Views |
Describe a view |
Create, alter the definition, and drop a view |
Retrieve data through a view |
Insert, update and delete data through a view |
Creating Other Database Objects |
Create, maintain and use sequences |
Create and maintain indexes |
Create private and public synonyms |
java |
City Planner |
CPU Scheduler |
Acme House System |
Number Searcher |
Password |
Producer Consumer |
Producer Consumer |
Producer Consumer No Buffer |
Producer Consumer Buffer 100 |
XML |
001.xml |
access_vs_sql.xml |
access_vs_sql.xsl |
admin |
admin |
arearate.htm |
arearate.xml |
arearate.xsd |
arearate.xsl |
arearate.xsx |
aspnet.xml |
aspnet.xsl |
aspnetbooks |
behave.htc |
behavior.htm |
bloglinks.xsl |
BottomLinks |
BUILDING.xml |
BUILDING.xsd |
Categories.xml |
cd_catalog.xml |
cdcatalog.xml |
cdcatalog.xsl |
cdcatalog_ |
cdcatalog |
cdcatalog_if |
cdcatalog_if |
cdcatalog |
cdcatalog |
cdcatalog |
Celebs.xml |
Celebs.xsl |
cities.txt |
cities_world.txt |
comment.htm |
comment.xml |
comment.xsd |
comment.xsl |
comment.xsx |
Contact.xml |
contact.xsl |
Contents.xml |
Contents.xslt |
COURSE.xml |
COURSE.xsd |
cursor_types.htm |
data_island.htm |
dispBooks.xsl |
dotnet.xml |
EditRecord.xml |
entire.xml |
entire.xsl |
ExtraLinks.xml |
ExtraLinks.xsl |
FACULTY.xml |
FACULTY.xsd |
FileName.xml |
FileName.xsd |
filesystem |
gakenheimer |
gakenheimer |
guestbook.xml |
home.xml |
home.xsd |
HTML Entities |
IS_QUALIFIED |
IS_QUALIFIED |
IS_REGISTERED |
IS_REGISTERED |
Java |
javascript |
javascript |
js.xml |
level1.xml |
LOGIN.xml |
LOGIN.xsd |
main.xsl |
MainLinks |
MainLinks |
MAJOR.xml |
MAJOR.xsd |
na_cities.xml |
Oracle |
OtherStuff |
OtherStuff |
people.xml |
PERSON.xsd |
RECORD.xsd |
rss.xml |
rss.xsl |
samples.xml |
SCHEDULE.xml |
SCHEDULE.xsd |
site.xml |
site.xsd |
sql.xml |
sql.xsl |
SS_table |
SS_table |
State.xml |
State.xsd |
states.htm |
states.xml |
states_move.htm |
states_move2.htm |
STUDENT.xsd |
TITLE.xml |
TITLE.xsd |
TopLinks.xsl |
updatedcontact |
world_cities.xml |
xmllinks.htm |
xmllinks.xml |
Algorithms |
Backjumping Algorithm |
Barnes-hut Algorithm |
Las Vegas and Monte Carlo Algorithm |
DBMS |
developer a database management system |
Downloads Directory |
balderdash |
content links |
CPUScheduler |
cheers |
CityPlanner |
Concat Strings |
Old Formal Resume |
joe resume .doc |
joe resume .txt |
Joseph Gakenheimer Resume .doc |
Knapsack |
My Shopping Cart Servlet |
NumberSearcher |
PasswordChecker |
SchoolSystem |
Stored Procedures |
Flash |
animals |
clock 0 |
clock 1 |
clock 2 |
clock 3 |
clock 4 |
clock 5 |
case 5 |
form |
hyperlink |
readymed |
snow |
HTML Templates |
calendar |
freud |
readymed |
excel |
old site template |
venus template |
Java |
Coming Soon |
JSP Research |
JSP Versus ASP |
J2EE Versus ASP.Net |
J2EE Versus ASP.Net Components |
MIS Windows 200 |
Action Plan - Active Directory Services |
Active Directory Services |
Challenges IS |
Monitoring Tools and Improvement |
Network Printing Environment |
An Overview of NTFS |
Proposal for Outsourcing Systems and Software Maintenance |
Hardware User Needs |
Windows 2000 Keypoints |
Operating Systems |
History of Operating Systems |
Operating System Questions |
Operating System Terms |
Clustering |
Open Source Acceptance |
Networking |
The Secure Socket Layer Review |
Network Design Proposal |
Exam 1 Review |
Exam 2 Review |
Software Engineering |
DinnerWare Software Design |
DinnerWare Software .doc |
DinnerWare Software .ppt |
Home |
Home |
About Me |
Archives |
FAQ |
My Resume |
My Portfolio |
Pics |
Site Map |
Updated: July 30, 2005; Joe Gakenheimer
© joegakenheimer.com