GBASE南大通用GBase 8s数据库-基本语法(1)

GBASE南大通用技术分享:GBase 8s DDL

数据库

新建数据库

create database [if not exists] <db_name> [in dbs_name] [with [buffered] log | with log mode ansi] [nlscasesensitive | nlscase insensitive];

重命名数据库

rename database <old_db_name> to <new_db_name>;

删除数据库

drop database [if exists] <db_name>;

DEMO

create database demo_db1;

rename database demo_db1 to demo_db2; 

drop database demo_db2;
[gbasedbt@devsvr ~]$ dbaccess - -
Your evaluation license will expire on 2022-06-18 00:00:00
> create database demo_db1;

Database created.

> rename database demo_db1 to demo_db2;  

  359: Cannot drop or rename the current database or any open database.
Error in line 1
Near character position 35
> database gbasedb;

Database closed.


Database selected.

> rename database demo_db1 to demo_db2;

Database renamed.

> drop database demo_db2;

Database dropped.

> 
 

GBASE南大通用技术分享:GBase 8s 表

新建表

create [standard | raw] table [if not exists] <table_name> (colname1 data_type1, colname2 data_type2, ...);

重命名表

rename table <old_table_name> to <new_table_name>;

删除表

drop table [if exists] <table_name>;

DEMO

create table t_user1(f_userid int, f_username varchar(20));

rename table t_user1 to t_user2;

drop table t_user2;
> database gbasedb;

Database closed.


Database selected.

> create table t_user1(f_userid int, f_username varchar(20));

Table created.

> rename table t_user1 to t_user2;

Table renamed.

> drop table t_user2;

Table dropped.

> 

新增列

alter table <table_name | synonym_name> 
add (new_column_name1 data_type1 [before old_column_n
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值