Support for common database differences Comparison notes

Source: Internet
Author: User

Support for common database differences Comparison notes

Class

Item

Oracle

SQL Server 2005 (+)

MYSQL 4.x

OSCAR

DB2

Service

JDBC Port

1521

1433 (Patch required)

3306

2003

Field type

Character

VARCHAR2

VARCHAR

VARCHAR or TEXT

VARCHAR

VARCHAR

Numerical

Number

NUMERIC

DECIMAL

Numeric/decimal

NUMERIC

Boolean

Number (1)

NUMERIC (1)

DECIMAL (1)

NUMERIC (1)

NUMERIC

Date Time

DATE

Datetime

Datetime

TIMESTAMP

(Date values can only be stored)

DATE

Function

System Time function

Sysdate

GETDATE ()

Now ()

GETDATE () or current_date

Current date

Long Date conversion function

To_date (' value ', ' yyyy-mm-dd hh24:mi:ss ')

Value

Value

To_timestamp (' value ', ' yyyy-mm-dd hh24:mi:ss ')

Value

Short Date conversion function

To_date (' value ', ' yyyy-mm-dd ')

Value

Value

To_date (' value ', ' yyyy-mm-dd ')

Value

SQL Grammar

Create a field

ALTER TABLE ... ADD ...

ALTER TABLE ... ADD ...

ALTER TABLE ... ADD ...

ALTER TABLE ... ADD ...

ALTER TABLE ... ADD COLUMN ...

modifying fields

ALTER TABLE ... MODIFY (...)

ALTER TABLE ... ALTER COLUMN ...

ALTER TABLE ... Change ...

ALTER TABLE ... ALTER COLUMN ...

ALTER TABLE ... ALTER COLUMN ...

Delete a field

ALTER TABLE ... DROP COLUMN

ALTER TABLE ... DROP COLUMN ...

ALTER TABLE ... DROP ...

ALTER TABLE ... DROP ...

Create a table

CREATE TABLE ... ()

CREATE TABLE ... ()

CREATE TABLE ... ()

CREATE TABLE ... ()

CREATE TABLE ... ()

Create a normal index

CREATE INDEX ... On ... ()

CREATE INDEX ... On ... ()

CREATE INDEX ... On ... ()

CREATE INDEX ... On ... ()

CREATE INDEX ... On ... ()

Create a unique index

CREATE UNIQUE INDEX ... On ... ()

CREATE UNIQUE INDEX ... On ... ()

CREATE UNIQUE INDEX ... On ... ()

CREATE UNIQUE INDEX ... On ... ()

CREATE UNIQUE INDEX ... On ... ()

Delete Index

DROP INDEX IndexName

DROP INDEX Table.indexname

ALTER TABLE ... DROP INDEX IndexName

DROP INDEX IndexName

DROP INDEX IndexName

Other:

DB Provider

SQL Paging Syntax

JDBC URL Sample

Oracle

SELECT * FROM (select RowNum r,t1.* from TableName t1 where other conditions and rownum < (current page * Number of rows per page +1) Order by id) T2 where T2. R> ((current page-1) * Number of rows per page)

Oracle.jdbc.driver.OracleDriver

Jdbc:oracle:thin:@192.168.0.3:1521:prj

Sql server

SELECT * FROM (select RowNum r,t1.* from TableName t1 where other conditions and rownum < (current page * Number of rows per page +1) Order by id) T2 where T2. R> ((current page-1) * Number of rows per page)

Net.sourceforge.jtds.jdbc.Driver

jdbc:jtds:sqlserver://192.168.0.2:1433/finaltest;characterencoding=gb2312

Mysql

SELECT * from TableName t1 where other conditions order by ID limit returns the offset of the record line, returning the maximum number of record rows

Offset start value is 0

Com.mysql.jdbc.Driver

jdbc:mysql://localhost:3306/aws40_test1?characterencoding=gb2312

Oscar

SELECT * from TableName t1 where other conditions order by ID limit count offset offset

Count returns a maximum of count rows

Offset the number of rows to ignore before starting to return the first row

Com.oscar.Driver

Jdbc:oscar://localhost:2003/osrdb

DB2

SELECT * FROM (select RowNumber () over () as row,taball.* from (SELECT * from tableName where other conditions order by ID) as T Aball) as TabPage WHERE Tabpage.row between start line number and end line number

Com.ibm.as400.access.AS400JDBCDriver

Jdbc:as400://172.16.16.7/aws

Support for common database differences Comparison notes

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.