--创建测试表
create or replace table student
(
    xh number(4), --学号
    xm varchar2(10), --姓名
    sex char(2), --性别
    birthday date, --日期
    sal number(7,2) --奖学金
);

--添加一个字段
alter table student add (studentid number(10));

--添加多个字段
alter table student add 
(
    xh number(4), --学号
    xm varchar2(10), --姓名
    sex char(2), --性别
    birthday date, --日期
    sal number(7,2) --奖学金
);

--删除一个字段
alter table student drop column xh;

--修改一个字段
--1.修改长度
alter table student modify (sex char(5));
--2.修改字段的类型
alter table student modify (sex varchar2(5));

--给表改名字
rename student to stuinfo;

--字段如何改名字
--1.先删除
alter table student drop column sal;  
--2.再添加
alter table student add(salary varchar2(6));
      
     

 

相关文章:

  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-03-07
  • 2021-12-25
  • 2022-02-05
  • 2022-01-08
  • 2022-01-04
猜你喜欢
  • 2022-12-23
  • 2021-07-23
  • 2021-05-22
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
相关资源
相似解决方案