Ggregate Functions (Transact-SQL) aggregation functionsAvg: Averaging pointsCount: Number of calculationsMax: Ask for maximum valueMin: Find minimum valueSum: SumFind Average heightSelect AVG (Shengao) from studentAs: Added column nameSelect AVG (Shengao) as average height from studentFind the numberSelect COUNT (*) from student where Xingbie = ' Male 'Ask for maximumSelect MAX (Shengao) from studentTo find the minimum valueSelect MIN (Shengao) from studentSumSelect SUM (Shengao) from studentUsi
Aggregate functions in the statistics of a ~, are often common gray. But there's a little bit to be aware of.Create Table#Tmp (AintBint )Insert into#Tmp (A, B)Values(1,NULL),(NULL,NULL),(NULL,3),(2,4)Select * from#Tmpa b----------- -----------1 NULLNULL NULLNULL 32 4Here I'll simply try using the count and Sum and AVG 3 most commonly used functions. This usage is very simple, just pay attention to the behavior of th
Aggregation class
The aggregation class allows youAccess its members directlyAnd has a special initialization syntax format. When a class meets the following conditions, we say it is aggregated:
All members are public
No constructor defined
No class initialization
There is no base class, and virtual functions are useless.
The following classes are all aggregate classes.
Struct data
{
Int ival;
String S;
};
We can provide a member initialization
number.Select rand () -- generate 0 ~ Random Number of 1 (the system time is used as the seed by default)Select rand (50) -- generate a fixed value (seed is set to a fixed 50)---------------- System functions ------------------------- Convert (target data type, which must be converted): Data Type ConversionSelect 1 + 2 -- addition operationSelect '1' + '2' -- character connectionSelect '1' + 2 -- display 3Select '1' + convert (varchar, 2) -- display 12-- Datalength (expression): calculated expr
MySQL Aggregate functions
I. AVG
AVG (col)
Returns the average value of a specified column.
Ii. COUNT
COUNT (col)
Returns the number of non-NULL values in the specified column.
3. MIN/MAX
MIN (col): returns the minimum value of a specified column.
MAX (col): returns the maximum value of a specified column.
Iv. SUM
SUM (col)
Returns the sum of all values of a specified column.
5. GROUP_CONCAT
GROUP_CONCAT ([DISTINCT] expr [, expr...][Order by {unsigned
Aggregate functions count, max, min, avg, sum...
Select count (*) from T_Employee
Select Max (FSalary) from T_Employee
Sort ASC ascending DESC descendingSelect * from T_Employee order by Fage
Sort by age in descending order. Sort by salary in ascending order if the age is the sameSelect * from T_Employee order by FAge DESC, FSalary ASC
Order by must be placed after the where clause
Wildcard FilterUse like for wildcard FilteringSingle-character wildca
Sometimes, your blog may need such a feature:
In their blog on the aggregation and display of Friends blog The latest article, so convenient for their timely understanding of friends, in addition, also facilitate visitors to find and this blog related blogs and articles.
This function you can call it "blog aggregation" or "blog network", at present, to achieve such a function of the software or services are limited: for example, Terac Sinfonia, Lilina, Mxna Although the function is very powerful
Sometimes, your blog may need such a feature:
In their blog on the aggregation and display of Friends blog The latest article, so convenient for their timely understanding of friends, in addition, also facilitate visitors to find and this blog related blogs and articles.
This function you can call it "blog aggregation" or "blog network", at present, to achieve such a function of the software or services are limited: for example, Terac Sinfonia, Lilina, Mxna Although the function is very powerf
Listagg (column name, ' Split symbol ')
Oracle 11g above a multiple-row query result with the specified column name merged into one line with the specified split symbol:
For example:
Table raw DATA:
Requirements: The data in the Mb1_transport_license_list table is grouped according to the transportation_license_id data, and the data of the Item_category_name column is merged.
Using aggregate functions Listagg solve
[SQL] view plain copy SELECT tran
'}}}
,
' Message ": {
" type ":" String "
},
" subject ": {
" type ":" String "
},
" To_user ": {
" Type ': "string",
"fields": {"
raw": {"
type": "string",
"index": "Not_analyzed"
}
}
}
}
}
}'
Mapping is equivalent to specifying a data type for a field. As you can see from the commands, some fields are set to string, and so on.
Here is a special note: in the "From_user" field, for example, there are two types, which are called "multiple field t
information Functions The commonly used information functions are: (1) View database connection ID and current database SELECT connection_id ();SELECT DATABASE (); (2) Check the ID number of the last input record ALTER TABLE Test ADD ID SMALLINT UNSIGNED keyauto_increment first;INSERT Test (First_name,last_name) VALUES (' 11 ', ' 22 ');SELECT last_insert_id ();SELECT * from Test; (3) View current user and version information (already used) SELECT USER ();SELECT VERSION (); aggregation Functions
Tags: style blog http io ar color OS sp strongOriginal: "T-SQL Series" Common functions-aggregate functionsAggregation functionsAverage AVG, standard deviation Stdev, variance var, max Max, Min min, total sum, count of times, max-min, coefficient of variation stdev/avg*100What is statisticsStatistics is the process of inferring the overall characteristics through sample characteristics.Similar to gambling, there is a certain risk.Reliability is influe
Label:We all know that when a case is applied in SQL, the information in the database is converted For example, select (Case sex if 0 then ' men ' else ' end) as sex from Studentinfo So what does it do in the aggregate function? SELECTSex fromStudentSELECTSexCOUNT(*) asNum fromStudentGROUP bySexSELECTSex,province,COUNT(*) asNum fromStudentGROUP bysex,provinceSELECTSex,province,COUNT(province) asNum fromStudentGROUP bysex,provinceSELECTSex,provin
The operation of the Aggregate function targets a series of values and returns a single value. Note: If a SELECT statement is used in many other expressions in the list of items in the SELECT statement, the select must use the GROUP by statement! First, all SQL instances are used to the following table
o_id
OrderDate
Orderprice
Customer
1
2008/12/29
1000
Bush
2
2008/11/23
routing process in the network all the detailed route, in the Aggregate-address 202.1.16.0 255.255.252.0 to do the aggregation, this time will be aggregated routing and detailed routing are advertised, Aggregate-address 202.1.16.0 255.255.252.0 Summary-only will suppress the detail route, which is identified as s, and is not sent to other BGP neighbors.In addition, we can specify that no specific route is
is not valid in the select list because the column is neither included in the aggregate function nor included in the GROUP by clauseSuddenly see this problem, the head of a blindfolded, do not know what the meaning, and then think about, trying to select the options in the back, the problem of natural solution!The following is the newspaper "OrderDate Select Shipcountry,sum (ShipVia) as totalvia,orderdate as thefirsttime from orders group by ShipCount
The Enumerable.aggregate extension method is the first method of the enumerable class (alphabetical rank) in the System.Linq namespace, but it is a relatively complex method in enumerable.
MSDN describes it by applying an accumulator function to a sequence. There are some notes in the note, the main effect of this method is more complex, under normal circumstances with Sum, Max, Min, average on it.
Look at the following code, with Sum, who will use aggrega
Use SQL to implement subtotal, aggregate, and sort bitsCN.com
-- Note: personal study notes are displayed in the ascending order of BANK_ID + OP_DATE.-- Test dataCreate table # TB (id varchar (10), BANK_ID VARCHAR (10), OP_DATE VARCHAR (10), OPERATOR_NO VARCHAR (20), amt decimal (10, 2 ))INSERT # tb select '20180101', '001', '20180101', 1111Union all select '20180101', '002', '20180101', 2222Union all select '20180101', '001', '20180101', 3333Union al
"Value="false"/> "Preserveloginurl"Value="true"/> "clientvalidationenabled"Value="true"/> "unobtrusivejavascriptenabled"Value="true"/> The second last one is to control whether the global client-side check is turned onControl of a page check:@{ html.enableclientvalidation (true); }True and without this code, the default is a checksum, and if set to false, the client-side checksum of the current page is invalidated2. About AjaxDebug and view the relevant HTTP information, you can open F
Sometimes, your Blog may need the following features:Aggregates and displays the latest Blog articles on your own Blog, so that you can learn about your friends in a timely manner. In addition, it is also convenient for visitors to find Blog and articles related to this blog.This function can be called "Blog aggregation" or "Blog broadcast". Currently, software or services that implement this function have restrictions: for example, although Terac Sinfonia, Lilina, and MXNA have powerful functio
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.