青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆-30  評論-67  文章-0  trackbacks-0


一、內部函數
  1、內部合計函數
    1)COUNT(*)          返回行數
    2)COUNT(DISTINCT COLNAME)   返回指定列中唯一值的個數
    3)SUM(COLNAME/EXPRESSION)   返回指定列或表達式的數值和;
    4)SUM(DISTINCT COLNAME)    返回指定列中唯一值的和
    5)AVG(COLNAME/EXPRESSION)   返回指定列或表達式中的數值平均值
    6)AVG(DISTINCT COLNAME)    返回指定列中唯一值的平均值
    7)MIN(COLNAME/EXPRESSION)   返回指定列或表達式中的數值最小值
    8)MAX(COLNAME/EXPRESSION)   返回指定列或表達式中的數值最大值
  2、日期與時間函數
    1)DAY(DATE/DATETIME EXPRESSION)   返回指定表達式中的當月幾號
    2)MONTH(DATE/DATETIME EXPRESSION)  返回指定表達式中的月份
    3)YEAR(DATE/DATETIME EXPRESSION)   返回指定表達式中的年份
    4)WEEKDAY(DATE/DATETIME EXPRESSION) 返回指定表達式中的當周星期幾
    5)DATE(NOT DATE EXPRESSION)     返回指定表達式代表的日期值
    6)TODAY                返回當前日期的日期值
    7)CURRENT[first to last]        返回當前日期的日期時間值
    8)COLNAME/EXPRESSION UNITS PRECISION  返回指定精度的指定單位數
    9)MDY(MONTH,DAY,YEAR)       返回標識指定年、月、日的日期值
    10)DATETIME(DATE/DATETIME EXPRESSION)FIRST TO LAST 返回表達式代表的日期時間值
    11)INTERVAL(DATE/DATETIME EXPRESSION)FIRST TO LAST 返回表達式代表的時間間隔值
    12)EXTEND(DATE/DATETIME EXPRESSION,[first to last])返回經過調整的日期或日期時間

    例子1、和UNITS合用,指定日期或時間單位(year,month,day,hour,minute,seond,fraction):
       let tmp_date = today + 3 UNITS day
    例子2、let tmp_date = MDY(10,30,2002)  -- 2002-10-30
    例子3、let tmp_date = today + interval(7) day to day --當前時間加上7天;
       注:該功能與1相似;
    例子4、EXTEND轉換日期或日期時間值
       let tmp_inthour = extend(datetime1,hour to hour)

  3、代數函數
   1)ABS(COLNAME/EXPRESSION):       取絕對值
   2)MOD(COLNAME/EXPRESSION,DIVISOR)  返回除以除數后的模(余數)
   3)POW(COLNAME/EXPRESSION,EXPONENT)  返回一個值的指數冥
     例子:let tmp_float = pow(2,3) --8.00000000

   4)ROOT(COLNAME/EXPRESSION,[index])  返回指定列或表達式的根值

   5)SQRT(COLNAME/EXPRESSION)      返回指定列或表達式的平方根值

   6)ROUND(COLNAME/EXPRESSION,[factor]) 返回指定列或表達式的圓整化值
   7)TRUNC(COLNAME/EXPRESSION,[factor]) 返回指定列或表達式的截尾值
     說明:上兩者中FACTOR指定小數位數,若不指定,則為0;若為負數,則整化到小數點左邊;
     注:ROUND是在指定位上進行4舍5入;TRUNC是在指定位上直接截斷;
     let tmp_float = round(4.555,2) --4.56
     let tmp_float = trunc(4.555,2) --4.55

  4、指數與對數函數
   1)EXP(COLNAME/EXPRESSION)    返回指定列或表達式的指數值
   2)LOGN(COLNAME/EXPRESSION)    返回指定列或表達式的自然對數值
   3)LOG10(COLNAME/EXPRESSION)   返回指定列或表達式的底數位10的對數值

  5、三角函數
   1)COS(RADIAN EXPRESSION)     返回指定弧度表達式的余弦值
   2)SIN(RADIAN EXPRESSION)     正弦
   3)TAN(RADIAN EXPRESSION)     正切
   4)ACOS(RADIAN EXPRESSION)     反余弦
   5)ASIN(RADIAN EXPRESSION)     反正弦
   6)ATAN(RADIAN EXPRESSION)     反正切
   7)ATAN2(X,Y)           返回坐標(X,Y)的極坐標角度組件

  6、統計函數
   1)RANGE(COLNAME)    返回指定列的最大值與最小值之差 = MAX(COLNAME)-MIN

(COLNAME)
   2)VARIANCE(COLNAME)  返回指定列的樣本方差;
   3)STDEV(COLNAME)    返回指定列的標準偏差;

  7、其他函數
   1)USER              返回當前用戶名
   2)HEX(COLNAME/EXPRESSION)    返回指定列或表達式的十六進制值
   3)LENGTH(COLNAME/EXPRESSION)  返回指定字符列或表達式的長度
   4)TRIM(COLNAME/EXPRESSION)   刪除指定列或表達式前后的字符
   5)COLNAME/EXPRESSION || COLNAME/EXPRESSION 返回并在一起的字符;

二、IDS內部函數
  1、DBSERVERNAME   返回數據庫服務器名 let tmp_char=DBSERVERNAME
  2、SITENAME     返回數據庫服務器名 let tmp_char=SITENAME
   說明:兩者功能相同;

  3、DBINFO(‘SPECIAL_KEYWORD')   返回只關鍵字值
   例子1:返回數據中每個表的DBSPACE名稱
     select dbinfo('dbspace',partnum),tabname from systables
     where tabid>99 and tabtype='T' (OK)
   例子2:返回任何表中插入的最后一個SERIAL值
     select dbinfo('sqlca.sqlerrd1') from systables where tabid = 1
   例子3:返回最后一個SELECT,INSERT,UPDATE,DELETE或EXECUTE PROCEDURE語句處理的行數;
     select dbinfo('sqlca.sqlerrd2') from systables where tabid=1;



?

Date Manipulation

One of the more difficult concepts in Informix's handling of date and time values concerns the use of the variables in arithmetic or relational expressions. You can add or subtract DATE and DATETIME variables from each other. You can add or subtract an INTERVAL to a DATE or DATETIME. Table 1 shows the results of different types of operations on DATE and DATETIME values.

Table 1. Operations on DATE and DATETIME Variables

First Operand

Operation

Second Operand

Result

DATE

-

DATETIME

INTERVAL

DATETIME

-

DATE

INTERVAL

DATE

+-

INTERVAL

DATETIME

DATETIME

-

DATETIME

INTERVAL

DATETIME

+-

INTERVAL

DATETIME

INTERVAL

+

DATETIME

DATETIME

INTERVAL

+-

INTERVAL

INTERVAL

DATETIME

-

CURRENT

INTERVAL

CURRENT

-

DATETIME

INTERVAL

INTERVAL

+

CURRENT

DATETIME

CURRENT

+-

INTERVAL

DATETIME

DATETIME

+-

UNITS

DATETIME

INTERVAL

+-

UNITS

INTERVAL

INTERVAL

*/

NUMBER

INTERVAL

Notice that it's always okay to subtract one DATE or DATETIME value from another, as shown here:

CURRENT - "07/01/1950" = INTERVAL (my age)
"12/25/2000" – CURRENT = INTERVAL (how long till Xmas?)

In such a case, the result is always an INTERVAL variable. It would make no sense to add two DATE or DATETIME values together. What could such an addition represent?

UNITS Keyword

When working with INTERVAL values, sometimes it is necessary to specify the precision with which you are dealing. For example, suppose you have the following field defined:

lead_time INTERVAL DAY to DAY

To add 10 days to the lead time you could use a SQL statement like this:

SELECT lead_time + INTERVAL(10) DAY to DAY
FROM orders

You could achieve the same results using the UNITS keyword:

SELECT lead_time + 10 UNITS DAY 
FROM orders

Like most other programming languages, SQL often allows you to achieve the same ends with different statements. Sometimes the choice is one of personal style. Other times, one format fits in better with a structured style of code writing than another format does.

Functions

There are several built-in functions that affect date and time calculations. They can apply to either DATE or DATETIME values, with some exceptions.

TODAY

The TODAY function returns a DATE data value representing the current date. For example, you could execute a SQL function like this:

UPDATE member SET change_date = TODAY
WHER member_number = 12345

CURRENT

The CURRENT function is similar to the TODAY function, except it returns a DATETIME value. Without specific qualifiers, the default is YEAR to FRACTION(3). You can change the precision by using the same YEAR to FRACTION qualifiers as you use for DATETIMES. Thus, this would be legal:

SELECT * from member
WHERE elapsed_time < CURRENT YEAR to DAY

DATE

The DATE function takes as input a non-DATE value such as CHAR, DATETIME, or INTEGER and returns the corresponding DATE value. For example, the following SQL translates a CHARACTER value to a DATE:

SELECT * from member
WHERE enrollment_date > DATE('01/01/99')

DAY

This function returns an integer representing the day of the month. Here's an example:

SELECT * from member
WHERE DAY(enrollment_date) > DAY(CURRENT)

MONTH

This performs like the DAY function except it returns an integer between 1 and 12 representing the month:

SELECT * from member
WHERE enrollment_date > MONTH('01/01/99')

WEEKDAY

This returns an integer representing the day of the week, with 0 being Sunday and 6 being Saturday:

SELECT * from member
WHERE WEEKDAY(enrollment_date) > WEEKDAY(CURRENT)

YEAR

This function is like the ones above, only it returns a four-digit integer representing the year.

EXTEND

This function allows you to use different precisions in a DATETIME than you have specified in the declaration of the variable. It uses the same FIRST to LAST syntax as the DATETIME variables. This function is used to adjust the precision of a DATETIME variable to match the precision of an INTERVAL that you are using in a calculation. If the INTERVAL value has fields that are not part of the DATETIME value that you are using in a calculation, use the EXTEND function to adjust the precision of the DATETIME. EXTEND can either increase or decrease the precision of a DATETIME, depending upon the FIRST and LAST values.

Suppose myvariable is declared as DATETIME YEAR to DAY. If you want to add or subtract an INTERVAL defined as MINUTE, you first have to extend the DATETIME as follows:

SELECT EXTEND(myvariable, YEAR to MINUTE) – 
INTERVAL(5) MINUTE to MINUTE
FROM member

The resulting value will be DATETIME YEAR to MINUTE.

MDY

The MDY function converts three-integer values into a DATE format. The first integer is the month and must evaluate to an integer in the range 1–12. The second integer is the day and must evaluate to a number in the range from 1 to however many days are in the particular month (28–31). The third expression is the year and must be a four-digit integer. Thus, the following MDY functions would each be valid:

MDY(7,1,1950)

returns a DATE of "07/01/50"

MDY(MONTH(TODAY), 1, YEAR(TODAY))

returns a DATE equal to the first day of the current month in the current year

Informix has extensive capabilities for manipulating dates and times, which can make for long and complex SQL statements. Using the three time-related data types and the time-related functions and keywords, you can accomplish almost any type of manipulation of time data. Unfortunately, getting there may be cryptic and painful. If you regularly do extensive date and time manipulation, you should understand all of the intricacies of these data structures.

Have fun!?


?

posted on 2006-10-30 14:44 含笑半步癲 閱讀(3905) 評論(0)  編輯 收藏 引用 所屬分類: 數據庫
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产精品一卡二卡| 西西裸体人体做爰大胆久久久| 亚洲一区二区三区视频播放| 日韩视频在线免费| 亚洲国产另类久久久精品极度| 狠狠久久五月精品中文字幕| 国内成人精品一区| 亚洲每日在线| 亚洲欧美日韩综合国产aⅴ| 欧美在线视频日韩| 欧美成人免费全部| 99国内精品| 久久av一区二区三区漫画| 麻豆成人在线播放| 国产精品盗摄久久久| 国产一区二区三区在线免费观看 | 夜夜嗨av一区二区三区四季av | 激情综合在线| 夜夜爽99久久国产综合精品女不卡| 亚洲影院色在线观看免费| 久久色在线观看| 99国产精品久久久久久久久久 | 欧美诱惑福利视频| 欧美激情一区二区三区不卡| 国产精品久久久亚洲一区 | 国产精品国产三级国产专播品爱网| 国产麻豆成人精品| 亚洲乱亚洲高清| 久久精品夜色噜噜亚洲a∨ | 国产亚洲一区精品| 日韩写真视频在线观看| 久久久国产成人精品| 亚洲美女在线观看| 久久一区免费| 国产资源精品在线观看| 在线亚洲欧美专区二区| 欧美电影免费观看| 性亚洲最疯狂xxxx高清| 欧美人体xx| 亚洲国产一区二区三区在线播 | 亚洲欧美一区二区精品久久久| 美女91精品| 国内精品久久久久影院色| 欧美国产成人精品| 欧美在线视频一区二区三区| 欧美国产日韩精品| 精品成人a区在线观看| 午夜国产精品视频| 99精品国产高清一区二区 | 欧美影院视频| 国产精品香蕉在线观看| 亚洲视频精品| 99精品国产在热久久| 欧美www视频在线观看| 国产一区清纯| 久久久久久高潮国产精品视| 亚洲图片欧美午夜| 欧美先锋影音| 午夜精品久久久久久久久久久| 亚洲精品欧美在线| 欧美日韩免费一区| 亚洲一区一卡| 亚洲一区二区毛片| 国产色爱av资源综合区| 久久国产视频网| 午夜免费久久久久| 狠狠狠色丁香婷婷综合久久五月 | 麻豆成人综合网| 久久狠狠亚洲综合| 亚洲国产裸拍裸体视频在线观看乱了 | 亚洲国产精品精华液网站| 男女精品视频| 欧美国产国产综合| 一区二区三区国产在线| 中文亚洲视频在线| 国产美女精品| 欧美成人亚洲成人| 欧美精品三级日韩久久| 亚洲一区综合| 亚洲欧美影院| 亚洲黄色三级| aa级大片欧美三级| 国产亚洲欧美激情| 欧美韩国日本一区| 亚洲精品一区二区三区四区高清| 欧美日韩卡一卡二| 久久成人18免费网站| 久久一二三国产| 99国产精品国产精品毛片| 亚洲自拍16p| 亚洲高清成人| 亚洲一区日韩在线| 红桃视频成人| 在线综合+亚洲+欧美中文字幕| 国产精品视频xxx| 欧美成人dvd在线视频| 欧美精品一区二区高清在线观看| 亚洲欧美韩国| 免费观看成人www动漫视频| 久久婷婷国产综合国色天香 | 精品av久久久久电影| 亚洲福利一区| 欧美日韩一区二区国产| 久久精品视频免费| 欧美日韩三级在线| 巨乳诱惑日韩免费av| 国产精品高清网站| 欧美成人免费全部| 国内精品久久久久影院薰衣草| 欧美激情欧美激情在线五月| 国产欧美日韩精品在线| 亚洲国产精品成人综合| 国产综合色在线| 99国产精品久久久久久久久久| 在线精品视频一区二区三四| 一本色道久久综合亚洲二区三区| 亚洲电影下载| 欧美在线地址| 欧美亚洲免费电影| 欧美日韩国语| 亚洲美女视频| 亚洲人成人77777线观看| 久久国产精品久久久久久久久久| 亚洲视频中文字幕| 欧美日韩国产综合视频在线| 美女视频黄免费的久久| 国内外成人在线视频| 亚洲愉拍自拍另类高清精品| 亚洲视频欧美在线| 欧美激情精品久久久久久黑人| 久久综合网hezyo| 国产亚洲一区在线播放| 午夜精品在线| 久久久久久电影| 国模精品娜娜一二三区| 欧美在线一区二区| 久久久精品日韩欧美| 国产午夜精品美女毛片视频| 亚洲一区二区三区精品动漫| 在线亚洲欧美| 欧美视频一区二区三区四区 | 欧美sm极限捆绑bd| 欧美激情在线观看| 亚洲精品欧美日韩| 欧美日韩一区在线| 一区二区三区国产在线| 亚洲影视在线播放| 国产精品久久久久久亚洲毛片| 一区二区三区精密机械公司| 亚洲欧美日本伦理| 国产日韩欧美亚洲| 久久精品二区亚洲w码| 欧美xxx在线观看| 亚洲欧洲一区二区在线观看| 欧美日韩播放| 亚洲一区二区免费看| 久久亚洲二区| 亚洲精品一区二区三区樱花| 欧美日韩一区二区三区在线看| 亚洲另类视频| 欧美主播一区二区三区美女 久久精品人| 国产伦精品一区二区三区视频黑人| 先锋影音久久| 亚洲国产精品久久久久秋霞影院| 一本色道久久| 国产精品久久久久久久久搜平片 | 99伊人成综合| 国产精品国产三级国产aⅴ入口 | 亚洲经典三级| 欧美日本网站| 亚洲免费网址| 亚洲电影下载| 一区二区日韩伦理片| 国产一区二区主播在线| 久色成人在线| 亚洲天堂av在线免费| 久久久夜色精品亚洲| 一区二区三区四区在线| 国产日本欧美在线观看| 欧美美女bbbb| 欧美在线短视频| 亚洲天堂免费观看| 亚洲福利视频专区| 久久精品国产亚洲aⅴ| 日韩亚洲欧美成人| 黄色精品免费| 国产精品一区二区a| 欧美激情aⅴ一区二区三区 | 欧美日韩国内| 久久精品成人| 亚洲一区二区三区精品视频| 欧美国内亚洲| 久久九九久精品国产免费直播 | 久久黄色影院| 亚洲综合色网站| 91久久久久久| 亚洲福利视频一区二区| 国产精品激情av在线播放| 欧美日韩国产一区| 久久久亚洲高清|