南大通用(GBase)迁移到瀚高(HGDB)

环境

系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:6.0,4.5

文档用途

南大通用数据库迁移到瀚高数据库常用字段类型说明。

详细信息

GBase同HGDB数据库数据类型对比:

GBase字段类型	HGDB字段类型
BIGINT	        INIT8/BIGINIT
BIGSERIAL	    BIGSERIAL
BYTE	        BYTE
BOOLEAN	        BOOLEAN/BOOL
CHAR(n)			CHAR(n)
CHARACTER(n)	CHAR(n)
CHARACTER VARYING	CHARACTER VARYING
DATA			DATA
DATATIME		DATATIME
DECIMAL			DECIMAL
DOUBLE PRECISION	DOUBLE PRECISION/FLOAT8
FLOAT			FLOAT8
INT				INT
INT8			INT8
INTERVAL		INTERVAL
MONEY			MONEY
NCHAR(n)		NCHAR(n)
NVARCHAR(n)		NVARCHAR2/VARCHAR/TEXT
NUMERIC			NUMERIC
REAL			REAL
SMALLFLOAT		FLOAT4
SMALLINT		SMALLINT
TEXT			TEXT
BLOB			BLOB/BYTEA
CLOB			CLOB/TEXT

测试例子:

1.GBase语法:

-- drop table if exists test;
create table test(

id bigserial not null ,

name character varying(30) ,

sex varchar(1) ,

age int ,

birthday DATE NOT null default TODAY ,

address text ,

primary key (id)

);




comment on column test.id is '主键';

comment on column test.name is '姓名';

comment on column test.sex is '性别';

comment on column test.age is '年龄';

comment on column test.birthday is '出生日期';

comment on column test.address is '家庭住址';

comment on table test is '人员信息表';



INSERT INTO dbtest:test

(id, name, sex, age, birthday, address)

VALUES(4, '小明', '1', 30, '2020-11-09', '济南');

INSERT INTO dbtest:test

(id, name, sex, age, birthday, address)

VALUES(1, '张三', '1', 23, '2020-03-10', '济南');

INSERT INTO dbtest:test

(id, name, sex, age, birthday, address)

VALUES(2, '小红', '0', 25, '1996-09-11', '潍坊');

INSERT INTO dbtest:test

(id, name, sex, age, birthday, address)

VALUES(3, '李四', '1', 24, '1996-09-10', '潍坊');

2.转化后HGDB语法:

-- drop table if exists test;

create table test(

id bigserial not null ,

name character varying(30) ,

sex varchar(1) ,

age int ,

birthday DATE NOT null default now() ,

address text ,

primary key (id)

);



comment on column test.id is '主键';

comment on column test.name is '姓名';

comment on column test.sex is '性别';

comment on column test.age is '年龄';

comment on column test.birthday is '出生日期';

comment on column test.address is '家庭住址';

comment on table test is '人员信息表';



INSERT INTO test

(id, name, sex, age, birthday, address)

VALUES(4, '小明', '1', 30, '2020-11-09', '济南');

INSERT INTO test

(id, name, sex, age, birthday, address)

VALUES(1, '张三', '1', 23, '2020-03-10', '济南');

INSERT INTO test

(id, name, sex, age, birthday, address)

VALUES(2, '小红', '0', 25, '1996-09-11', '潍坊');

INSERT INTO test

(id, name, sex, age, birthday, address)

VALUES(3, '李四', '1', 24, '1996-09-10', '潍坊');
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值