1、oracle
create tablespace testDB
datafile 'testDB.dbf'
size 50M;
--创建用户
create user hkl
identified by hkl
default tablespace testDB;
--授权管理员权限
grant dba to hkl;
-- drop tablespace UserInfo;
-- drop user hkl cascade ;
create table hkl.user_info(
id int primary key not null,
name varchar2(20),
age int
);
--drop table hkl.USER_INFO
--SELECT * FROM ALL_TAB_COMMENTS WHERE OWNER='HKL' AND TABLE_NAME IN ('USER_INFO')
select * from hkl.user_info;
--创建序列
CREATE SEQUENCE user_info_ID
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9999999999999999
START WITH 1
CACHE 20;
--创建触发器
create or replace trigger user_info_TG_INSERT_ID
before insert on user_info_ID for each row
begin
select get_seq_next('user_info_ID') into:new.id from dual;
end;
-- 获取序列下一个值
create or replace function get_seq_next (seq_name in varchar2) return number
is
seq_val number ;
begin
execute immediate 'select '|| seq_name|| '.nextval from dual' into seq_val ;
return seq_val ;
end get_seq_next;
select get_seq_next('user_info_ID') from dual
2、mongDB
//show dbs
use testMongo1;
db.testMongo1.insert({"name":"远近"});
db.col.find({"name":"远近"}).pretty()
3、redis
在这里插入代码片