Oracle从创建表空间到建表

版权声明: https://blog.csdn.net/qq_33459369/article/details/84675697

一、创建表空间

--表空间
create tablespace APPLE logging datafile 'E:\Other-shore\OracleDate\APPLE.dbf' size 1024M AUTOEXTEND ON NEXT 1024M MAXSIZE UNLIMITED;
--临时表空间
create temporary tablespace TEMP_APPLE  tempfile 'E:\Other-shore\OracleDate\TEMP_APPLE.dbf' size 1024M AUTOEXTEND ON NEXT 1024M MAXSIZE UNLIMITED;

二、创建用户

--创建用户
CREATE USER sky identified by sky default tablespace APPLE temporary tablespace TEMP_APPLE;
--赋予dba角色
grant dba to sky with admin option;

三、建表

--建表
create table PEO(
  ID number(3) constraint pk_id primary key,
  name varchar2(20),
  sex varchar2(10)
);
--向表添加注释 
comment on table peo is '人员表';
comment on column peo.name is '姓名';
--插入数据
insert into peo values(1,'张三','男');
--查询数据
select * from peo;

结语:以上从表空间➡用户➡表的过程清晰明了。

猜你喜欢

转载自blog.csdn.net/qq_33459369/article/details/84675697
今日推荐