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

隨筆-30  評(píng)論-67  文章-0  trackbacks-0


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

    例子1、和UNITS合用,指定日期或時(shí)間單位(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 --當(dāng)前時(shí)間加上7天;
       注:該功能與1相似;
    例子4、EXTEND轉(zhuǎn)換日期或日期時(shí)間值
       let tmp_inthour = extend(datetime1,hour to hour)

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

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

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

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

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

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

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

(COLNAME)
   2)VARIANCE(COLNAME)  返回指定列的樣本方差;
   3)STDEV(COLNAME)    返回指定列的標(biāo)準(zhǔn)偏差;

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

二、IDS內(nèi)部函數(shù)
  1、DBSERVERNAME   返回?cái)?shù)據(jù)庫服務(wù)器名 let tmp_char=DBSERVERNAME
  2、SITENAME     返回?cái)?shù)據(jù)庫服務(wù)器名 let tmp_char=SITENAME
   說明:兩者功能相同;

  3、DBINFO(‘SPECIAL_KEYWORD')   返回只關(guān)鍵字值
   例子1:返回?cái)?shù)據(jù)中每個(gè)表的DBSPACE名稱
     select dbinfo('dbspace',partnum),tabname from systables
     where tabid>99 and tabtype='T' (OK)
   例子2:返回任何表中插入的最后一個(gè)SERIAL值
     select dbinfo('sqlca.sqlerrd1') from systables where tabid = 1
   例子3:返回最后一個(gè)SELECT,INSERT,UPDATE,DELETE或EXECUTE PROCEDURE語句處理的行數(shù);
     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 含笑半步癲 閱讀(3898) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 數(shù)據(jù)庫
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            一区二区三区四区国产| 久久综合色综合88| 欧美黄色一级视频| 久久视频在线看| 国产日韩在线看| 国产精品99久久久久久久久| 99精品免费| 欧美福利精品| 欧美激情在线| 亚洲精品久久久久中文字幕欢迎你 | 欧美亚洲免费电影| 亚洲欧美在线播放| 国产精品久久国产愉拍| 日韩午夜高潮| 亚洲影视在线| 国产精品久久久久久久电影| 一区二区三区不卡视频在线观看| 99re6热在线精品视频播放速度| 欧美aaaaaaaa牛牛影院| 亚洲丰满在线| 亚洲国产欧美一区| 欧美二区在线看| 日韩视频―中文字幕| 亚洲午夜国产一区99re久久| 欧美日韩精品久久| 国产精品99久久久久久www| 午夜电影亚洲| 国产视频一区在线观看| 久久成人免费电影| 免费毛片一区二区三区久久久| 在线观看三级视频欧美| 免费美女久久99| 亚洲精品一级| 午夜精品久久久久久久蜜桃app | 亚洲国产精品热久久| 免费精品视频| 中日韩高清电影网| 久久xxxx精品视频| 亚洲电影成人| 欧美午夜不卡影院在线观看完整版免费 | 国产精品入口夜色视频大尺度| 亚洲一区bb| 久久婷婷一区| 日韩午夜高潮| 国产三区二区一区久久| 久久综合久久综合久久综合| 亚洲人成毛片在线播放| 亚久久调教视频| 亚洲第一视频网站| 国产精品久久久久久久9999 | 亚洲国产免费| 国产精品久久久亚洲一区| 久久国产色av| 一区二区不卡在线视频 午夜欧美不卡在 | 欧美96在线丨欧| 中文无字幕一区二区三区| 国产视频一区在线| 欧美日韩成人综合在线一区二区| 午夜亚洲一区| 日韩视频一区二区三区| 久久综合色影院| 亚洲欧美日韩国产综合精品二区| 激情综合视频| 国产精品久久久久久户外露出| 美女精品在线观看| 午夜久久久久| 日韩午夜av在线| 欧美大片在线观看一区| 久久不见久久见免费视频1| 日韩午夜av在线| 亚洲第一伊人| 韩日在线一区| 国产精品一页| 国产精品国产自产拍高清av| 欧美xxx成人| 久久精品人人做人人爽| 亚洲午夜电影网| 日韩一区二区精品葵司在线| 女主播福利一区| 久久婷婷丁香| 久久精品视频在线| 欧美一区二区高清| 亚洲免费网址| 亚洲在线免费| 亚洲视频中文字幕| 夜夜嗨av一区二区三区网站四季av| 1769国内精品视频在线播放| 国产一区激情| 国产视频一区在线观看| 国产精品一区=区| 国产精品久在线观看| 欧美日韩国产综合久久| 欧美精品手机在线| 欧美激情中文字幕一区二区| 美乳少妇欧美精品| 免费不卡欧美自拍视频| 久久久精品欧美丰满| 久久精品国产在热久久| 欧美在线短视频| 欧美中文字幕精品| 久久激情一区| 久久综合九色综合欧美就去吻| 久久久久久网| 美女尤物久久精品| 欧美成人午夜影院| 欧美精品免费视频| 欧美日韩一区二区三区在线看| 欧美日韩亚洲在线| 国产精品乱码人人做人人爱| 国产精品永久免费视频| 国产欧美一二三区| 红桃视频一区| 亚洲欧洲在线观看| 中文在线资源观看视频网站免费不卡| 日韩视频在线永久播放| 亚洲午夜久久久久久久久电影院| 亚洲一区久久| 久久精品人人做人人爽| 欧美成人国产一区二区| 亚洲国产精品免费| 亚洲视频在线观看免费| 欧美一区二区三区免费视频| 久久精品夜夜夜夜久久| 欧美第一黄网免费网站| 国产精品久久久久婷婷| 狠狠久久五月精品中文字幕| 亚洲精品自在久久| 午夜久久99| 欧美大片一区二区三区| 夜夜嗨av一区二区三区网站四季av| 亚洲无吗在线| 久久午夜精品| 国产精品久久久久久影视| 激情综合久久| 亚洲图片在区色| 久久天天躁夜夜躁狠狠躁2022 | 夜夜嗨av一区二区三区中文字幕| 亚洲视频成人| 久久午夜精品一区二区| 日韩午夜电影av| 久久久精品tv| 国产精品日韩久久久久| 亚洲电影成人| 欧美在线视频a| 亚洲欧洲日本国产| 久久av一区二区三区漫画| 欧美日本亚洲韩国国产| 国产一区二区三区直播精品电影| 亚洲精品永久免费| 久久人人精品| 亚洲字幕在线观看| 欧美人与性动交a欧美精品| 国产偷久久久精品专区| 99视频有精品| 欧美高清成人| 久久精品国产精品亚洲精品| 欧美性一区二区| 日韩一级片网址| 免费91麻豆精品国产自产在线观看| 一本色道久久综合亚洲精品小说| 久久精品在线免费观看| 国产精品午夜视频| 亚洲桃色在线一区| 亚洲激情在线观看| 免费亚洲电影| 亚洲成色999久久网站| 久久九九99| 亚洲欧美日韩一区| 欧美三日本三级少妇三99 | 亚洲黄网站在线观看| 久久天堂av综合合色| 欧美一激情一区二区三区| 国产精品日韩欧美| 亚洲欧美色一区| 在线视频中文亚洲| 欧美视频精品在线| 一区二区三区四区五区精品| 亚洲激情视频在线播放| 欧美凹凸一区二区三区视频| 亚洲高清色综合| 欧美成人黑人xx视频免费观看| 久久久中精品2020中文| 国产主播一区二区三区| 久久久噜噜噜久久| 久久www免费人成看片高清| 国产视频一区欧美| 久久久亚洲欧洲日产国码αv| 香蕉久久国产| 极品尤物av久久免费看| 裸体丰满少妇做受久久99精品| 久久精品99| 在线观看91久久久久久| 欧美成人精品| 欧美精品久久久久a| av成人免费在线| 中国亚洲黄色| 国内精品久久国产| 欧美成人视屏| 欧美日韩精品在线播放| 亚洲一区综合|