• orcle增删改操作及alter修改表字段操作


    orcle增删改操作:操作前确保当前用户有增删改的权限。

    --创建表
    create table itcast(
    pid number(10),
    pname varchar2(10)
    );
    drop table itcast;
    
    --复制表
    create table product1 as select * from product;
    
    --表重命名
    alter table product1 rename to product;
    --插入数据
    insert into itcast(pid,pname) values (2,'xxx');
    commit;
    
    insert into itcast(pid,pname) values (1,'xxx');
    commit;
    --更新数据
    
    update itcast
    set pid=3
    where pname='xxx';

    --删除数据
    delete from itcast
    where pid=2;
    --修改表
    --增加字段
    alter table itcast add(address varchar2(10));
    --修改表字段
    alter table itcast modify(address varchar2(20));
    --删除表字段
    alter table itcast drop column address;
    --字段重命名
    alter table itcast rename column addres to address;
    --表重名
    --alter table 表名 rename to 新表名
    -- 删除表
    --删除表中所有记录
    delete from itcast;
    --删除表
    drop table itcast;
    --删除表再创建表
    truncate table itcast;

     

  • 相关阅读:
    SQL INJECTION的SQL Server安全设置
    跨数据库查询
    IIS to secure
    win2003 服务器设置 完全版
    Taskkill命令详解
    PsExec
    Sql Server自增列处理
    Index Data
    Sql Server常用查询汇总
    Symbian S60 SDK模拟器自动退出的解决
  • 原文地址:https://www.cnblogs.com/nongma-reddy/p/oracle_crud_alter.html
Copyright © 2020-2023  润新知