首页 > 数据库技术 > 详细

oracle对用户、 表、字段的基本操作

时间:2018-06-13 11:11:53      阅读:257      评论:0      收藏:0      [点我收藏+]
1.创建用户并设置密码
    create user username identified by password ;
 
2.修改用户密码
    alter username identified by password ;
 
3.删除用户
    drop user username
 
4.赋予用户权限
 赋予用户所有权限:
    grant all privileges to username;
 赋予用户部分权限:
   grant connect to username;
   grant resource to username;
   grant create snapshot to username;
   grant create synonym to username;
   grant create table to username;
   grant create view to username;
   grant select any table to username;
   grant create any trigger to username;
   grant create any view to username;
   grant select any dictionary to username;
   grant unlimited tablespace to username;
 

5.添加表

   create table sys_log (

     log_id nvarchar2(36) not null,

     create_time number(13) default null,

    CONSTRAINT pk_logId PRIMARY KEY (log_id) --指定主键
  );
 
6.为表的某个字段添加索引
    create INDEX createTime_index --索引名称
    on
    sys_log --表名 (create_time --字段名);
 
7.插入数据
    insert into sys_log (log_id,CREATE_TIME) values(‘1‘,1528787854000);
 
8.修改某个字段允许为空
    ALTER TABLE 表名 MODIFY 字段名 字段类型 NULL;
 
9.增加字段
   alter table sys_file add(
     ip NVARCHAR2(20) default null
   );
   comment on column sys_file.ip is ‘上传人的ip‘;

 

oracle对用户、 表、字段的基本操作

原文:https://www.cnblogs.com/dhjmjava/p/9175923.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!