




已阅读5页,还剩31页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第一章 聚集函数11 AVG.平均数12 CORRELATION.返回系数13 COUNT统计函数14 COVARIANCE协方差函数15 GROUPING.分组函数16 MAX.最大值17 MIN.最小值18 Regression.回归函数19 STDDEV偏差函数110 SUM.求和函数111 VARIANCE.方差函数第二章 标量函数21 ABS.绝对值22 ASCII.ASCII值23 BLOB.返回BLOB值24 CEIL最小整数值25 CHAR.转换字符串26 CHR.与ASCII相反27 CLOB. 返回CLOB值28 COALESCE判断是否为空29 CONCAT.字符串拼接210 COS.余弦函数211 COSH.弧度函数212 COT.余切函数213 DATE.日期函数214 DAY返回天数215 DAYNAME.返回星期216 DAYOFWEEK一周内第N天217 DAYOFWEEK_ISO一周内第N天218 DAYOFYEAR.一年内第N天219 DAYS返回累计天数220 DBCLOB返回DBCLOB值221 DECIMAL返回十进制表示的值222 DECRYPT_BIN数据加密函数223 DECRYPT_CHAR数据加密函数224 DEGREES. .返回弧度值225 DIGITS.用字符串表示数值226 DOUBLE.返回双精度浮点型227 ENCRYPT数据加密函数228 EVENT_MON_STATE.返回事件监视器状态229 EXP.指数函数230 FLOAT. 返回单精度浮点型231 FLOOR.最大整数值232 GETHINT.取加密后的数据233 GENERATE_UNIQUE.生成唯一值函数234 GRAPHIC.返回媒体类型235 HEX返回16进制表示的值236 HOUR.返回时间中的小时237 INSERT查找替换函数238 LOCATE.查找函数239 INTEGER取整函数240 LENGTH.取长度函数241 LONG_VARCHAR.返回长字符型242 LONG_VARGRAPHIC返回长媒体型243 LTRIM.去左边空格244 RTRIM.去右边空格2451.1 AVG aggregate function -AVG-(-+-+-expression-)-+-CORRELATION-+-(-expression1-,-expression2-)-COUNT-(-+-+-+-expression-+-)-+-COVARIANCE-+-(-expression1-,-expression2-)-GROUPING-(-expression-)-MAX-(-+-+-expression-)-MIN-(-+-+-expression-)-+-REGR_AVGX-+-(-expression1-,-expression2-)-0REGR_R2(expression1, expression2) = 1 if VARIANCE(expression1)=0 REGR_AVGX(expression1, expression2) = AVG(expression2) REGR_AVGY(expression1, expression2) = AVG(expression1) REGR_SXX(expression1, expression2) =REGR_COUNT(expression1, expression2) * VARIANCE(expression2) REGR_SYY(expression1, expression2) =REGR_COUNT(expression1, expression2) * VARIANCE(expression1) REGR_SXY(expression1, expression2) =REGR_COUNT(expression1, expression2) * COVARIANCE(expression1, expression2) If the set is not empty and VARIANCE(expression2) is equal to zero, then the regression line either has infinite slope or is undefined. In this case, the functions REGR_SLOPE, REGR_INTERCEPT, and REGR_R2 each return a null value, and the remaining functions return values as defined above. If the set is empty, REGR_COUNT returns zero and the remaining functions return a null value. The order in which the values are aggregated is undefined, but every intermediate result must be within the range of the result data type. The regression functions are all computed simultaneously during a single pass through the data. In general, it is more efficient to use the regression functions to compute the statistics needed for a regression analysis than to perform the equivalent computations using ordinary column functions such as AVERAGE, VARIANCE, COVARIANCE, and so forth. The usual diagnostic statistics that accompany a linear-regression analysis can be computed in terms of the above functions. For example: Adjusted R2 1 - ( (1 - REGR_R2) * (REGR_COUNT - 1) / (REGR_COUNT - 2) ) Standard error SQRT( (REGR_SYY-(POWER(REGR_SXY,2)/REGR_SXX)/(REGR_COUNT-2) ) Total sum of squares REGR_SYY Regression sum of squares POWER(REGR_SXY,2) / REGR_SXX Residual sum of squares (Total sum of squares)-(Regression sum of squares) t statistic for slope REGR_SLOPE * SQRT(REGR_SXX) / (Standard error) t statistic for y-intercept REGR_INTERCEPT/(Standard error) * SQRT(1/REGR_COUNT)+(POWER(REGR_AVGX,2)/REGR_SXX) Example: Using the EMPLOYEE table, compute an ordinary-least-squares regression line that expresses the bonus of an employee in department (WORKDEPT) A00 as a linear function of the employees salary. Set the host variables SLOPE, ICPT, RSQR (double-precision floating point) to the slope, intercept, and coefficient of determination of the regression line, respectively. Also set the host variables AVGSAL and AVGBONUS to the average salary and average bonus, respectively, of the employees in department A00, and set the host variable CNT (integer) to the number of employees in department A00 for whom both salary and bonus data are available. Store the remaining regression statistics in host variables SXX, SYY, and SXY. SELECT REGR_SLOPE(BONUS,SALARY), REGR_INTERCEPT(BONUS,SALARY),REGR_R2(BONUS,SALARY), REGR_COUNT(BONUS,SALARY),REGR_AVGX(BONUS,SALARY), REGR_AVGY(BONUS,SALARY),REGR_SXX(BONUS,SALARY), REGR_SYY(BONUS,SALARY),REGR_SXY(BONUS,SALARY)INTO:SLOPE, :ICPT,:RSQR, :CNT,:AVGSAL, :AVGBONUS,:SXX, :SYY,:SXYFROM EMPLOYEEWHERE WORKDEPT = A00 When using the sample table, the host variables are set to the following approximate values: SLOPE: +1.71002671916749E-002ICPT: +1.00871888623260E+002RSQR: +9.99707928128685E-001CNT: 3AVGSAL: +4.28333333333333E+004AVGBONUS: +8.33333333333333E+002SXX: +2.96291666666667E+008SYY: +8.66666666666667E+004SXY: +5.06666666666667E+006 1.9 STDDEV aggregate function 求平均差值函数-STDDEV-(-+-+-expression-)-SUM-(-+-+-expression-)-+-VARIANCE-+-(-+-+-expression-)-+-ABS-+-(-expression-)-ASCII-(-expression-)-BLOB-(-string-expression-+-+-)-+-CEILING-+-(-expression-)-CHAR-(-character-expression-+-+-)-CHAR-(-datetime-expression-+-+-)-CHAR-(-integer-expression-)-CHAR-(-decimal-expression-+-+-)-CHAR-(-floating-point-expression-+-+-)- -,-decimal-character-The CHAR function returns a fixed-length character string representation of: 注意:The CAST expression can also be used to return a string expression. The result of the function is a fixed-length character string. If the first argument can be null, the result can be null. If the first argument is null, the result is the null value. Examples: 使用(样表一)select char(rq,usa) from test where id=ddd结果为:10/01/2006select char(rq,iso) from test where id=ddd结果为:2006-10-01例子2:Assume that the PRSTDATE column has an internal value equivalent to 1988-12-25. The following function returns the value 12/25/1988. CHAR(PRSTDATE, USA) Assume that the STARTING column has an internal value equivalent to 17:12:30, and that the host variable HOUR_DUR (decimal(6,0) is a time duration with a value of 050000 (that is, 5 hours). The following fu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年烟草设备维修工新员工岗位专业知识笔试题目及答案
- 2025年乘务人员考试题库及答案
- 药用植物学与生药学测试题及答案
- 高校经济合同模板(3篇)
- 综评面试题库及答案书
- 安全输液考试题及答案
- 高粱地种植合同模板(3篇)
- 大连淘宝店铺产品生命周期管理代运营协议
- 2025国家公务员面试题及答案
- 体育公司与个人运动员参赛合同
- 幽门螺杆菌治疗进展
- 金属热处理工(中级工)职业技能认定考试题库(含答案)
- 导尿术操作并发症及处理规范
- 电磁学(赵凯华-陈熙谋-)-第二版-课后答案1
- 塔吊临近建筑物的安全防护方案
- 老年安宁疗护病区设置标准
- 人工智能训练师理论知识考核要素细目表四级
- 全国职业院校技能大赛高职组(服装创意设计与工艺赛项)备赛试题库(含答案)
- 2024年医疗质量安全核心制度及病历书写规范考核试题及答案
- 学前儿童产生问题行为的原因分析
- 成人重症患者人工气道湿化护理专家共识 解读
评论
0/150
提交评论