栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

人大金仓kingbaseV8常用sql

人大金仓kingbaseV8常用sql

人大金仓kingbaseV8常用sql 一、数据库

– 展示大小写状况

show case_sensitive

– 修改字符编码

alter table 模式名称.表名称 CHARACTER SET utf8 COLLATE utf8_general_ci;

– 查看数据库

select * from sys_database; 

– 查看表空间

select * from sys_tablespace; 

– 查看语言

select * from sys_language;

– 查看角色用户

select * from sys_user;

– 查看会话进程

select * from sys_stat_activity;

– 查看当前账号会话数

select count(*), usename from sys_stat_activity group by usename;

– 查看系统所有表

SELECt * FROM sys_tables ;

–查看表字段

select * from information_schema.columns 

– 查看索引

select * from sys_index ;
二、查询数据库连接情况
select  * from pg_stat_activity; 

– 杀死空闲连接

SELECt pg_terminate_backend(pid) FROM pg_stat_activity WHERe state='idle'

– 查询最大连接数

show max_connections;

– 超级连接数

show superuser_reserved_connections;
三、模式:

– 模式创建

CREATE SCHEMA 模式名称 

– 模式删除

DROP SCHEMA 模式名称

– 修改模式名称

alter schema 被修改模式名称 rename to 需要重命名模式名称 
四、表字段

– 修改字段类型

alter table  模式名称.表名称 modify  修改字段  需要被修改字段类型;

– 删除字段

alter table  模式名称.表名称 drop 需要删除字段; 

– 添加注释

comment on column 表名称.字段名称 is '注释内容';

– 创建索引

CREATE INDEX "索引名称" ON 模式名称.表名称 (字段名称);
– 创建表及注释字段参考
CREATE TABLE weather (
city varchar(80),--城市
temp_lo int, -- 最低温度
temp_hi int, -- 最高温度
prcp real, -- 湿度
date date ---日期
);
comment on column weather.temp_lo is '最低温度';
comment on column weather.temp_hi is '最高温度';
comment on column weather.prcp is '湿度'
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/723032.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号