第三节 SQL函数转换
3.1 A
GGREGATE FUNCTIONS ..................................................................................................................17
3.1.1 AVG .......................................................................................................................................17
3.1.2 COUNT...................................................................................................................................18
3.1.3 COUNT(*) ..............................................................................................................................18
3.1.4 MAX.........................................................................................................................................18
3.1.5 MIN..........................................................................................................................................18
3.1.6 SUM.........................................................................................................................................19
3.1.7 STDDEV ..................................................................................................................................19
3.1.8 VARIANCE ..............................................................................................................................19
3.2 D
ATE FUNCTIONS...............................................................................................................................20
3.2.1 CONVERT................................................................................................................................21
3.2.2 DATEADD...............................................................................................................................21
3.2.3 DATEDIFF ..............................................................................................................................22
3.2.4 DATENAME ............................................................................................................................23
3.2.5 DATEPART..............................................................................................................................23
3.2.6 GETDATE................................................................................................................................24
3.2.7 LAST_DAY...............................................................................................................................24
3.2.8 NEW_TIME..............................................................................................................................25
3.3 M
ATHEMATICAL FUNCTIONS..............................................................................................................25
3.3.1 ABS ........................................................................................................................................27
3.3.2 ACOS .....................................................................................................................................27
3.3.3 ASIN.......................................................................................................................................27
3.3.4 ATAN .....................................................................................................................................27
3.3.5 ATAN2 ...................................................................................................................................27
3.3.6 CEILING................................................................................................................................28
3.3.7 COS........................................................................................................................................28
3.3.8 COSH.....................................................................................................................................28
3.3.9 CONVERT..............................................................................................................................28
3.3.10 COT .......................................................................................................................................29
3.3.11 DEGREES..............................................................................................................................29
3.3.12 EXP........................................................................................................................................29
3.3.13 FLOOR ..................................................................................................................................29
3.3.14 LOG .......................................................................................................................................30
3.3.15 LOG10 ...................................................................................................................................30
3.3.16 %............................................................................................................................................30
3.3.17 PI ...........................................................................................................................................30
3.3.18 POWER..................................................................................................................................31
3.3.19 RADIANS...............................................................................................................................31
3.3.20 RAND.....................................................................................................................................31
3.3.21 ROUND..................................................................................................................................31
3.3.22 SIGN ......................................................................................................................................32
3.3.23 SIN .........................................................................................................................................32
3.3.24 SINH ......................................................................................................................................32
3.3.25 SQRT......................................................................................................................................32
3.3.26 TAN........................................................................................................................................32
3.3.27 TANH.....................................................................................................................................33
3.4 R
OW AGGREGATE FUNCTIONS .........................................................................................................34
3.4.1 AVG .......................................................................................................................................35
3.4.2 COUNT..................................................................................................................................35
3.4.3 MAX.......................................................................................................................................35
3.4.4 MIN........................................................................................................................................35
3.4.5 SUM.......................................................................................................................................35