oracle表操作学习讲解

oracle表操作

1.建表语句

create table student(
       sno   varchar2(3) not null,
       sname varchar2(9) not null,
       ssex  varchar2(3) not null,
       sbirthday date,
       sclass varchar2(5),
       constraint pk_student primary key(sno)
);
--注释
comment on column student.sno is '学号(主键)';
comment on column student.sname is '学生姓名';
comment on column student.ssex is '学生性别';
comment on column student.sbirthday is '学生出生年月日';
comment on column student.sclass is '学生所在班级';

2.添加一列

alter table student add age number(2);

3.删除一列

alter table student drop column age;

5.删除表

drop table student;

6.插入数据

insert into student(sno,sname,ssex,sbirthday,sclass) values(1,'小明','男',to_date('1977-09-01','yyyy-mm-dd'),9533);

7.修改数据

update student set sno=100 where sno=1;

8.删除数据

delete student where sno=100;
(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐