文件名称:更改一个现存的列-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2024-05-15 13:25:09
SQL 基础
更改一个现存的列 * 可以更改一个现存列的数据类型、长度、以及缺省值. 对于缺省值的修改只影响到以后会修改的列. SQL> ALTER TABLE dept30 2 MODIFY (ename VARCHAR2(15)); Table altered. * Modifying a Column You can modify a column definition by using the ALTER TABLE statement with the MODIFY clause. Column modification can include changes to a column’s datatype, size, and default value. Guidelines Increase the width or precision of a numeric column. Decrease the width of a column if the column contains only null values and if the table has no rows. Change the datatype if the column contains null values. Convert a CHAR column to the VARCHAR2 datatype or convert a VARCHAR2 column to the CHAR datatype if the column contains null values or if you do not change the size. A change to the default value of a column affects only subsequent insertions to the table.