Cover | Table of Contents | Colophon
|
Category
|
Example datatypes and abbreviations
|
Description
|
|---|---|---|
|
BINARY
|
BINARY LARGE OBJECT
(BLOB)
|
This datatype stores binary string values in hexadecimal format.
Binary string values are stored without reference to any character
set and without any length limit.
|
|
BOOLEAN
|
BOOLEAN
|
CONSTRAINT [constraint_name] constraint_type [(column [,...])] [predicate] [constraint_deferment] [deferment_timing]
|
SQL2003 Command
|
SQL2003 class
|
DB2
v8.1
|
|---|
|
Platform
|
Command
|
|---|---|
|
DB2
|
Supported
|
|
MySQL
|
Not supported
|
|
Oracle
|
Supported
|
|
PostgreSQL
|
Supported
|
|
SQL Server
|
Supported
|
SELECT ... WHERE expression comparison {ALL | ANY | SOME} ( subquery )
|
Function
|
Usage
|
|---|---|
AVG(expression)
|
Computes the average value of a column given by
expression.
|
CORR(dependent, independent) |
Computes a correlation coefficient.
|
COUNT(expression)
|
Counts the rows defined by the expression.
|
COUNT(*) |
Counts all rows in the specified table or view.
|
COVAR_POP ( dependent, independent) |
Computes population covariance.
|
COVAR_SAMP( dependent, independent) |
Computes sample covariance.
|
CUME_DIST( value_list) WITHIN GROUP (ORDER BY sort_list) |
Computes the relative rank of a hypothetical row within a group of
rows, where the rank is equal to the number of rows less than or
equal to the hypothetical row divided by the number of rows in the
group.
|
DENSE_RANK( value_list) WITHIN GROUP (ORDER BY sort_list) |
Generates a dense rank (no ranks are skipped) for a hypothetical row
( |
FUNCTION_NAME(expr) OVER {window_name|(window_specification)} window_specification ::= [window_name][partitioning][ordering][framing] partitioning ::= PARTITION BY value [, value...] [COLLATE collation_name] ordering ::= ORDER [SIBLINGS] BY rule [, rule...] rule ::= {value|position|alias} [ASC|DESC] [NULLS {FIRST|LAST}] framing ::= {ROWS|RANGE} {start|between} [exclusion] start ::= {UNBOUNDED PRECEDING|unsigned-integer PRECEDING|CURRENT ROW} between ::= BETWEEN bound AND bound bound ::= {start|UNBOUNDED FOLLOWING|unsigned-integer FOLLOWING} exclusion ::= {EXCLUDE CURRENT ROW|EXCLUDE GROUP |EXCLUDE TIES|EXCLUDE NO OTHERS}
FUNCTION_NAME(expr) OVER (window_clause) window_clause ::= [partitioning] [ordering [framing]] partitioning ::= PARTITION BY value [, value...] ordering ::= ORDER [SIBLINGS] BY rule [,
|
Function category
|
Explanation
|
|---|---|
|
Built-in
|
Performs operations on values or settings built into the database.
Oracle uses the term "built-in" to
describe all the specialty functions that are provided by Oracle, and
thus "built into" their DBMS. This
is a distinct and separate usage from the
"built-in" functions described
here.
|
|
CASE and CAST
|
While these two functions operate on scalar input values, they are in
a category all their own. CASE supplies
IF-THEN logic to SQL statements and
CAST can convert values from one datatype to
another.
|
|
Date and Time
|
Performs operations on temporal datatypes and
returns values in a temporal datatype format.
There is no SQL2003 function that operates on a temporal datatype and
returns a temporal result. The closest function is
EXTRACT (covered in Section 4.4.3 later in this
chapter), which operates on temporal values and returns numeric
values. Functions returning temporal values but operating on no
arguments are covered in the later Section 4.4.1.
|
|
Numeric
|
Performs operations on numeric values and returns numeric values.
|
|
String
|
Performs operations on character values (e.g.,
|
VALUES( ABSVAL( -1 ) ) -> 1SELECT ACOS( 0 ) -> 1.570796SELECT ASCII('x') -> 120SELECT ASIN( 0 ) -> 0.000000SELECT ATAN( 3.1415 ) -> 1.262619http://java.sun.com/jdbc.
Open method on the connection object. The
connection object can be an OdbcConnection,
SqlConnection, or an
OleDbConnection. The
OdbcConnection is designed for any ODBC
datasource, and the OleDbConnection type will work
with any OLE DB Provider. For the highest performance data access,
use connection objects specifically tuned to the specific database
platform, such as SqlConnection for Microsoft SQL
Server. Following is the syntax for creating a
Connection object in ADO.NET:{Odbc|OleDb|Sql}Connection connection =
new {Odbc|OleDb|Sql}Connection(connection_string);
connection.Open( );key1=value1; key2=value2; key3=value3; ...
OdbcConnection:DSN=MyOracleDSN; UID=scott; PWD=tiger;
DRIVER={SQL Server};SERVER=(local);UID=sa;PWD=;DATABASE=pubs;