如何修改表字段的名字
发布时间:2019-05-05
如下表,希望修改first_name字段名字为fname:
SQL> desc dept80
Name Null? Type
----------------------------------------- -------- --------------
EMPLOYEE_ID NUMBER(6)
LAST_NAME NOT NULL VARCHAR2(10)
ANNSAL NUMBER
HIRE_DATE NOT NULL DATE
JOB_ID VARCHAR2(9)
FIRST_NAME DATE
sql> alter table dept80 rename column first_name to fname;
成功后:
SQL> desc dept80;
Name Null? Type
----------------------------------------- -------- --------------------
EMPLOYEE_ID NUMBER(6)
LAST_NAME NOT NULL VARCHAR2(10)
ANNSAL NUMBER
HIRE_DATE NOT NULL DATE
JOB_ID VARCHAR2(9)
FNAME DATE
SQL> desc dept80
Name Null? Type
----------------------------------------- -------- --------------
EMPLOYEE_ID NUMBER(6)
LAST_NAME NOT NULL VARCHAR2(10)
ANNSAL NUMBER
HIRE_DATE NOT NULL DATE
JOB_ID VARCHAR2(9)
FIRST_NAME DATE
sql> alter table dept80 rename column first_name to fname;
成功后:
SQL> desc dept80;
Name Null? Type
----------------------------------------- -------- --------------------
EMPLOYEE_ID NUMBER(6)
LAST_NAME NOT NULL VARCHAR2(10)
ANNSAL NUMBER
HIRE_DATE NOT NULL DATE
JOB_ID VARCHAR2(9)
FNAME DATE