Data analysis functions

A plurality of desired data in the table, the table would like to take a plurality of connector fields join
field two as table data, to merge union
deduplication distinct
packet aggregation function and group by
screening where (row) / having (group)
hope query results from high to low / low to high ranking? - sort order by
the numeric variables into categorical variables? - case when the Con
not want global ordering, grouping and sorting require
Rank () repeats the same sort, the total number will not change, meaning that such results will be sorted 1,1,3 occur;

DENSE_RANK () repeats the same sort, the total number will be reduced, meaning that such results will be sorted 1,1,2 occur.

ROW_NUMBER () is not repeated in the same sort, based on order.
Desired time fields function operating time
to_date time function can be converted to a string type time, then subsequent calculations;

The common functions include the extracted date year () / month () / day () / hour () / minute () / second ()

Date arithmetic function comprising datediff (enddate, stratdate) calculate the time difference between the two times (Day);

date_sub (stratdate, days) start date startdate reduce return date days days.

date_add (startdate, days) start date startdate increase return date days days.

Guess you like

Origin www.cnblogs.com/songyuejie/p/12654803.html