zoukankan      html  css  js  c++  java
  • DDL操作

    DDL: create/drop/truncate/alter
    创建表
    create table mytab6
    (
    id number ,
    name varchar(10),
    age number
    )
    ;
    注意事项:
    1.权限和空间问题
    2.表名的规定:
    a.必须以字母开头
    b.表名只能包含: 大小写字母、数字、_、$、#
    c.长度 1-30个字符
    d.不能与数据库中其他对象重名(表,视图、索引、触发器、存储过程....)
    e.不能与 保留字重名
    查看保留字:DBA账户
    sqlplus / as sysdba
    查看保留字:
    select *from v$reserved_words order by keyword asc ;

    设置某个字段的宽度:
    字符
    col KEYWORD for a10
    数字
    col LENGTH for 9999

    修改表:
    a.追加新列

    alter table mytab6 add myother varchar2(10) ;

    b.修改列
    修改列的长度
    alter table mytab6 modify myother varchar2(20) ;
    修改列的类型

    alter table mytab6 modify myother number ;
    注意: blob/clob不能修改 ->先删除此列,重新追加

    alter table mytab6 add myother2 blob ;

    alter table mytab6 modify myother2 number ;

    c删除列
    alter table mytab6 drop column myother2 ;

    d重命名列
    alter table mytab6 rename column myother to myother3 ;

    删除表
    select *from tab; 表以及回收站中的表
    drop table mytab6; -->放在了回收站
    查看回收站
    show recyclebin;

    清空回收站
    purge recyclebin;

    还原回收站
    闪回
    flashback table '需要恢复的表名(original_name)' to before drop;

    删除表 并清空: drop table test02 purge ;

  • 相关阅读:
    POJ
    CodeForces
    51Nod 1256 扩展欧几里得求乘法逆元
    SDUT 3917
    SDUT 3918
    从零开始实现asp.net MVC4框架网站的用户登录以及权限验证模块 详细教程
    bootstrap资料索引
    理解Login函数
    细说@Html.ActionLink()的用法
    RGB颜色对照表
  • 原文地址:https://www.cnblogs.com/mayouyou/p/13198128.html
Copyright © 2011-2022 走看看