DB2 function Daquan

Source: Internet
Author: User
Tags abs acos asin numeric value rand rtrim square root

Name of function function explanation Examples of functions
AVG () Returns the average of a set of values. SELECT AVG (SALARY) from Bsempms;
CORR (), CORRELATION () Returns the relationship factor for a pair of values. SELECT CORRELATION (Salary,bonus) from Bsempms;
COUNT () Returns the number of rows or values in a set. SELECT COUNT (*) from Bsempms;
COVAR (), covariance () Returns the covariance of a pair of values. SELECT COVAR (Salary,bonus) from Bsempms;
MAX () Returns the maximum value in a set of values. SELECT MAX (SALARY) from Bsempms;
MIN () Returns the minimum value in a set of values. SELECT MIN (SALARY) from Bsempms;
STDDEV () Returns the standard deviation of a set of values. SELECT STDDEV (SALARY) from Bsempms;
SUM () Returns the and of a set of data. SELECT SUM (SALARY) from Bsempms;
VAR (), VARIANCE () Returns the variance of a set of numeric values. SELECT VARIANCE (SALARY) from Bsempms;
ABS (), Absval () Returns the absolute value of the parameter. SELECT ABS ( -3.4) from Bsempms;
ACOS () Returns the inverse cosine value of the parameter. SELECT ACOS (0.9) from Bsempms;
ASCII () Returns the ASCII code for the leftmost character of an integer parameter. SELECT ASCII (' R ') from Bsempms;
ASIN () Returns the inverse chord function for the argument of the angle expressed in radians. SELECT ASIN (0.9) from Bsempms;
ATAN () Returns the inverse tangent of the parameter, which is the parameter of the angle expressed in radians. SELECT ATAN (0.9) from Bsempms;
ATAN2 () Returns the inverse tangent of the x and y coordinates of an angle expressed in radians. SELECT ATAN2 (0.5,0.9) from Bsempms;
BIGINT () Returns a 64-bit integer representation of a number or string in an integral type constant. SELECT BIGINT (emp_no) from Bsempms;
CEILING () OR CELL () Returns the smallest integer value that is greater than or equal to the parameter. SELECT CEILING (3.56) from Bsempms; SELECT ceil (4.67) from Bsempms;
CHAR () Returns a string representation of DateTime, String, Integer, Decimal, or double-precision floating-point numbers. SELECT CHAR (SALARY, ', ') from Bsempms;
CHR () Returns the character that has the ASCII code specified by the parameter. SELECT CHAR (167) from Bsempms;
CONCAT () Returns a connection of two strings. SELECT CONCAT (Emp_no,emp_nam) from Bsempms;
Year () Returns the year portion of a value. SELECT year (' 2003/01/02 ') from Bsempms;
VARCHAR () Returns a string representation of the variable length of a string, date type, and graph string. SELECT VARCHAR (emp_nam,50) from Bsempms;
UCASE () OR UPPER () Returns the uppercase of a string. SELECT UCASE (Emp_nam) from Bsempms; SELECT UPPER (emp_no) from Bsempms;
TRUNCATE () OR TRUNC () The value is truncated and returned from the position to the right of the decimal point of the expression. SELECT TRUNCATE (345.6789,2) from Bsempms;
Time () Returns the time in a numeric value. SELECT time (' 2001-03-19.12.30.123456 ') from Bsempms;
SUBSTR (EXP1,EXP2) Returns the substring starting at EXP2 from the EXP1 string. SELECT SUBSTR (' CDNJFDJFJD ', 5) from Bsempms; SELECT SUBSTR (' CDNJFDJFJD ', 5,2) from Bsempms;
SQRT () Returns the square root of the parameter. SELECT SQRT from Bsempms;
SPACE () Returns the length specified by the parameter, including a space string. SELECT SPACE (Ten) from Bsempms;
SECOND () Returns the second part of a numeric value. SELECT SECOND (' 18:34:32 ') from Bsempms;
RTRIM () Deletes a space at the trailing end of a string. SELECT RTRIM (' COMMENT ') from Bsempms;
ROUND (EXP1,EXP2) Returns the rounded value starting at the EXP2 position to the right of the EXP1 decimal point. SELECT ROUND (2345.6789,2) from Bsempms
REPLACE (EXP1,EXP2,EXP3) Replace all the EXP2 in EXP1 with EXP3 SELECT CHAR (REPLACE (' romandd ', ' NDD ', ' CCB '), ten) from Bsempms;
REPEAT (EXP1,EXP2) Returns the string after EXP1 repeats EXP2 times. SELECT CHAR (REPEAT (' REPEAT ', 3), up) from Bsempms;
REAL () Returns a single-precision floating-point number representation of a numeric value. SELECT REAL (Ten) from Bsempms;
RAND () Returns the number of random floating-point numbers between 0 and 1. SELECT RAND () from Bsempms;
POWER (EXP1,EXP2) Returns the EXP2 power of the EXP1. SELECT POWER (2,5) from Bsempms;
Posstr (EXP1,EXP2) Returns the position of the EXP2 in EXP1. SELECT (' abcdefgh ', ' D ') from Bsempms;
Nullif (EXP1,EXP2) Null if EXP1=EXP2, otherwise EXP1  
Nodenumber () Returns the partition number of the row. SELECT Nodenumber (emp_no) from Bsempms;
MONTH () Returns the month portion of a numeric value. SELECT MONTH (' 2003/10/20 ') from Bsempms;
MOD (EXP1,EXP2) Returns the remainder of EXP1 divided by EXP2. SELECT MOD (20,8) from Bsempms;
MINUTE () Returns the minute part of a numeric value. SELECT MINUTE (' 18:34:23 ') from Bsempms;
LTRIM () Remove the spaces in front of the string. SELECT LTRIM (' cddd ') from Bsempms;
HOUR () Returns the hour portion of a numeric value. SELECT HOUR (' 18:34:23 ') from Bsempms;
DOUBLE () If the argument is a numeric expression, returns the floating-point number that corresponds to it, and returns the string expression for the argument if it is a string expression. SELECT DOUBLE (' 5678 ') from Bsempms;
EXP () Returns the exponential function of the parameter. SELECT EXP (2) from Bsempms;
FLOAT () Returns a floating-point representation of a number. SELECT FLOAT (789) from Bsempms;
Floor () Returns the largest integer less than or equal to the parameter. SELECT Floor (88.93) from Bsempms;
HEX () Returns a 16-binary representation of a value represented as a string. SELECT HEX (+) from Bsempms;

DB2 function Daquan

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.