Welcome 微信登录

首页 / 数据库 / MySQL / Oracle中的数据类型和表的管理

日期类型
   date 包含年月日和时分秒
   timestamp 这是Oracle9i对date数据类型的扩展 (时间戳)date类型的时间更精确
   图片类型   blob 二进制数据可以存放图片 和声音 4G
 oracle表的管理 创建表一个student表的语句  create table student(
    xh number(4),
    xm varchar2(20),
    sex char(2),
    birthday date,
    sal number(7,2)
    );
  创建表一个Tclass表的语句   create table Tclass(
     class_id number(2),
     cName varchar2(20)
     );
   修改表
   在Student表中添加一个字段class_id
   alter table student add(class_id number(2));   在Student表中修改一个字段xm
   alter table student modify (xm varchar2(30))   在Student表中删除一个字段xm
  alter table student drop column xm;  怎样改oracle中的默认日期(因为在oracle中日期默认为 "日月年")   alter session set nls_date_format="yy-mm-dd"
  使用is 关键字查询null值
  select * from student where birthday is null;
   使用like关键字
  select * from student where xh like "%3%";  更新student表中xh=1234的birthday为 null值
  update student set birthday = null where xh = 1234  删除数据
  delete from student;
 
   oracle 支持事务回滚
 设置 一个点 savepoint a ;
 执行 delete from student 语句 删除表中的所有数据
 然后回到 我们设置的点a  执行的语句 :rollback to a ;
 执行完后我们在去查询数据表的数据 将会 回到删除前的状态。 使用truncate 删除表 表的结构还在, 不写日志,无法找回删除的记录 , 但速度快。
执行语句:truncate table student 使用delete 删除表
 使用delete删除会将表的结构删除 这张表将不会存在。
  • 0
  • 顶一下
hibernate调用Oracle存储过程如何估算Oracle数据库所需的UNDO表空间的大小相关资讯      Oracle基础教程 
  • Oracle块编程返回结果集详解  (11/10/2013 10:45:58)
  • Oracle基础教程之设置系统全局区  (08/22/2013 14:24:00)
  • Oracle基础教程知识点总结  (06/18/2013 07:43:32)
  • Oracle基础教程之tkprof程序详解  (10/22/2013 11:49:50)
  • Oracle基础教程之sqlplus汉字乱码  (07/18/2013 16:30:00)
  • Oracle 管理之 Linux 网络基础  (02/16/2013 18:37:35)
图片资讯      
  • Redhat 5.5 Oracle
  • Oracle Database 实例
  • 玩转Oracle 10g实战教
  • Oracle EM中设置基于
  • Oracle EM 此网站的安
  • Oracle Library Cache
  • 什么是Oracle Key-
  • Oracle 中用一个表的
本文评论 查看全部评论 (0)
表情: 姓名: 字数

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款