,ch04.13730 Page 166 Wednesday, November 29, 2000 4:43
,ch04.13730 Page 167 Wednesday, November 29, 2000 4:43 PM Microsoft SQL Server supports all the built-in scalar functions. Oracle does not support the built-in scalar functions shown above; however, it supports USER as a synonym of CURRENT_USER and SYSDATE as a synonym of CURRENT_ TIMESTAMP. MySQL supports all the SQL99 built-in scalar functions, plus both of Oracle s variants. PostgreSQL supports USER, as defined in SQL99, as a synonym for CURRENT_USER. In addition, MySQL supports NOW( ) and UNIX_TIMESTAMP( ) as synonyms of the function CURRENT_TIMESTAMP. PostgreSQL supports all the SQL99 built-in scalar functions except SESSION_USER. Example The following queries retrieve the values from built-in functions. Notice that the various vendors return dates in their native formats: /* On MySQL */ SELECT CURRENT_TIMESTAMP; -> ‘2001-12-15 23:50:26′ /* On Microsoft SQL Server */ SELECT CURRENT_TIMESTAMP GO -> ‘Dec 15,2001 23:50:26′ /* On Oracle */ SELECT USER FROM dual; -> dylan Numeric Scalar Functions The list of official SQL99 numeric functions is rather small. The various vendors provide quite a large supplement of mathematical and statistical functions. MySQL supports many of these commands in its SQL99 incarnations. The other database products offer the same capabilities of numeric scalar functions through their own internally defined functions, but they do not share the same name as those declared by the SQL standard. The supported numeric functions and syntax are listed in Table 4-4. Table 4-4: SQL99 Numeric Functions Functions Function BIT_LENGTH(expression) CHAR_LENGTH(expression) EXTRACT(datetime_expression datepart FROM expression) OCTET_LENGTH(expression) POSITION(starting_string IN search_string) Usage Returns an integer value representing the number of bits in an expression. Returns an integer value representing the number of characters in an expression. Allows the datepart to be extracted (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, TIMEZONE_HOUR, or TIMEZONE_MINUTE ) from an expression. Returns an integer value representing the number of octets in an expression. This value is the same as BIT_LENGTH/8. Returns an integer value representing the starting position of a string within the search string. MIN and MAX 167
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP MySQL Web Hosting services