`
mowengaobo
  • 浏览: 162059 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

Dropping Columns

阅读更多
Home » Articles » 8i » Here

Dropping Columns

Only with the release of Oracle 8i has it been possible to drop a column from a table. Prior to this it was neccessary to drop the entire table and rebuild it. Now you can mark a column as unused (logical delete) or delete it completely (physical delete).

Logical Delete

On large tables the process of physically removing a column can be very time and resource consuming. For this reason you may decide to logically delete it:

ALTER TABLE table_name SET UNUSED (column_name);
ALTER TABLE table_name SET UNUSED (column_name1, column_name2);

Once this is done the columns will no longer be visible to the user. If at a later date you have time to physically delete the columns this can be done by:

ALTER TABLE table_name DROP UNUSED COLUMNS;

On large tables you can reduce the amount of undo logs accumulated by using the CHECKPOINT option which forces a checkpoint after the specified number of rows has been processed:

ALTER TABLE table_name DROP UNUSED COLUMNS CHECKPOINT 250;

The DBA_UNUSED_COL_TABS view can be used to view the number of unused columns per table.

Physical Delete

To physically drop a column you can use one of the following syntaxes, depending on whether you wish to drop a single or multiple columns:

ALTER TABLE table_name DROP COLUMN column_name;
ALTER TABLE table_name DROP (column_name1, column_name2);

Dropping a column from a table will cause all unused columns in that table to be dropped at the same time.

Hope this helps. Regards Tim...

分享到:
评论

相关推荐

    MySQL and JSON A Practical Programming Guide 2018

    Dropping a Collection 12 Programming with the MySQL Document Store Programming Examples Python Example Node.JS Example PHP Example Traditional SQL vs. MySQL Document Store The MySQL Shell and ...

    Your Excel Survival Kit: Your Guide to Surviving and Thriving in an Excel world

    Dropping Your Dread of Formulas Getting to Know the Common Excel Functions Understanding the Copying Functions Roling inthe Wortkshets Rolling in the Worksheets rTinting in Excel Charts,Charts,Charts ...

    Bootstrap 4 responsive web design

    Offset columns 23 Completing the grid rows 24 Nesting rows 24 Finishing the grid 26 Fluid container 28 We need some style! 28 There are headings everywhere 30 Playing with buttons 31 [ ii ] More ...

    Sql for mysql

    5.4 Assigning Names to Result Columns . . . . . . . . . . . . . . . . . . . . 92 5.5 The Column Specification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5.6 The User Variable and the ...

    i-vector的工具箱

    After dropping the low SNR frames, acoustic features are further post-processed to remove the linear channel effects. Cepstral mean and variance normalization (CMVN) is commonly used for the post-...

    SQL21日自学通

    The Use of DISTINCT When Selecting Multiple Columns487 Dropping an Unqualified Table 487 The Use of Public Synonyms in a Multischema Database488 The Dreaded Cartesian Product 488 Failure to Enforce ...

    曲线拟合工具CurveExpert 1.0

    columns starting with a negative number to be discarded. Fixed. + Entering a user model with no parameters was allowed when it shouldn't have been. Now, a syntax error is generated. + the Window|...

    21天学习SQL V1.0

    21天学习SQL V1.0.pdf 66 SQL 21 日自学通(V1.0) 翻译人笨猪 ...日期/时间函数............................................................................................................ADD_MONTHS..................

    Doctrine ORM for PHP.pdf

    Table of Contents Introduction....................................................................................................13 Code Examples.........................................................

Global site tag (gtag.js) - Google Analytics