Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 17:23:39
Original
1020 people have browsed it

Oracle表管理-----怎么样创建表-------------------------------------------------------建表 学生表 sqlgt;create table

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

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!