你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle基础教程之表的增删改查

[日期:2012-12-10] 来源:Linux社区  作者:Linux [字体: ]

Oracle表管理-----怎么样创建表
-------------------------------------------------------
建表
  学生表
    sql>create table student(
 xh number(4),--学号
 xm varchar2(20),---姓名
 sex char(2),---性别
 birthday date,---出生日期
 sal number(7,2),----奖学金
 );
---------------------------------------------------------
表修改
添加一个字段
 sql>alter table student add(classid number(2));
修改字段的长度
  sql>alter table student modify (xm varchar2(30));
删除一个字段
  sql>alter table student drop column sal;
修改表的名字
 sql>rename student to stu
删除表
  sql>drop table student;

---------------------------------------------------------
添加数据
Oracle中的默认日期格式‘DD-MON-YY’dd  日子(天) mon 是月

份 yy是2位的年
改日期的默认格式:
alter seesion set nls_date_format = 'yyyy-mm-dd'

==========================================================
当你在数据库中插入了null值的数据的时候,你想根据这些null来

把这个数据查出来
错误的:select *  from student where birthday='';
正确的是:select * from student  where birthday is null;
这是Oracle和其它数据库之间不一样的地方  请牢记
select * from student  where birthday is not null;

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

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