当前位置:Gxlcms > mysql > Oracle基础教程之表的增删改查

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

时间:2021-07-01 10:21:17 帮助过:23人阅读

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

人气教程排行