How to remove some columns from an existing table?

Let's say my table's structure is as follows:
Table name: EMPLOYEE
Columns: Name, Birthdate, Gender, Salary, Hometown, Language and so on.
There are data in the table. Now I want to remove columns Hometown and Language, and I don't care the data loss. Also, there is no constraint.
What's the sql command to do this? Thanks!

I think you need to be a bit more specific than stating that something is not correct.
It is perfectly correct and proper to drop a column from a table even when there is data. The problem comes when you need to drop a column and the window you have to perform the expensive operation of actually reclaiming the disk space is insufficient. If that is the case (and there is no indication from the original poster that is the case, but it's certainly conceivable), it may make sense to mark the column as unused, which is a quick update to the data dictionary and then drop the unused columns at a later date when you have a larger window. This is incredibly useful in a handful of larger systems, but not particularly necessary in most systems most of the time. It wouldn't make sense to mark a column unused and then immediately drop the column.
If you are going to go the SET UNUSED route, your syntax is incorrect. Once you mark the column unused, you can't drop the column by name any longer (since you can add a column with the unused column's old name, it's also potentially rather dangerous). You have to use the DROP UNUSED COLUMNS clause
SQL> desc x;
Name                                      Null?    Type
COL1                                      NOT NULL NUMBER
COL2                                               NUMBER
SQL> alter table x set unused column col2;
Table altered.
SQL> alter table x drop column col2;
alter table x drop column col2
ERROR at line 1:
ORA-00904: "COL2": invalid identifier
SQL> alter table x drop unused columns;
Table altered.Justin

Similar Messages

  • How to insert select columns from one internal table to another

    Hi,
    How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
    regards,
    Sriram

    Hi,
    If your question is for copying data from 1 int table to other ;
    we can use
    APPEND LINES OF it_1 TO it_2.
    or if they have different columns then:
    loop at it_1 into wa_it1.
    move wa_it1-data to wa_it2-d1.
    apped wa_it2 to it_2.
    clear wa_it2.
    endloop.
    thnxz

  • How to remove selected image from a light table?

    According to the Aperture User Manual, when I select an image on a light table, I should be able to remove it (while still leaving it in the light table browser). However, this seems to work only for the image I most recently added to the light table -- when I select an image I added just before the most recent, the button at the upper left for "Light Table Put Back Selected" is grayed out. (Also, the command-shift-P shortcut shown in the tooltip doesn't do anything.) Am I misunderstanding the use of this button? Doing something wrong? I added some images, and decided I wanted to put a few of them back, but can't figure out a way to do that. Makes the light table pretty useless except for layout of a set of images you are already committed to. Doesn't seem possible.

    Hey, thanks -- everything worked as you described. It never would have occurred to me that the "put back" button refers to the browser selection not the layout selection, for reasons I give below.
    I think Aperture exhibits some conceptual confusion here. First of all, a "light table" is created by the New > Light Table command, and you add images to the newly created light table just as you would add them to an album. But those images don't go on the light table layout until you drag them from the browser to the layout table. The "put back" button and "remove from light table" contextual menu command both mean remove from the layout. The phrasing of the contextual menu command make it sounds as if it will remove the clicked image from the light table's collection of images, like removing an image from an album -- it would have made more sense to name this command "put back". Furthermore, the "put back" button is above the layout display, not above the browser, which to me implies that it applies to selections in the layout display. To select an image in the browser, and click "put back selected" seems backwards -- if you just selected the image in the browser, your attention is focused on the browser, not the layout; from the browser's point of view, the button should read "bring back" not "put back".
    The documentation didn't really help when I was trying to figure this out. Sometimes the Aperture documentation refers to just a "light table", as on the overview on page 732. On pages 733 and 734, though, it refers to a "light table album". On page 735 of the Aperture manual there is a very brief explanation of how "to add images to the light table" and "to remove an image from the light table". Here, "light table" refers to the layout not the album. The explanation of the "Put Back Selected" button says to select an image then click the button, and the picture shown is of an image selected in the layout, not in the browser.

  • How to remove a column from alv table

    Hi All
    How to remove a specific column from alv table.?
    Thanks & Regards
    SUN

    For delete u can follow the above post..
    Fo making invisible :
    data m_col type ref to cl_salv_wd_column.
    m_col = alv_mode->IF_SALV_WD_COLUMN_SETTINGS->GET_COLUMN (' col1' ).
    m_col->SET_VISIBILITY( '01'  ).

  • How we remove some fields from SAP standard one's

    Hi,
    i am very new to SAP SD .if the client do not want some fields from standard one's how we can remove those fields.(example u take Standard sales order).

    HI, you cannot hice many fields in SAP, since they all need for something.
    try to explain this to your customer; furthermore many fields are filled form the master data so the users don't have do mind of them.
    Anyway you can alter the screens using the transaction variants: go to IMG
    Spro: SAPNetwaever->general settings->Field Display Characteristics->Configure Application Transaction Fields
    Reward if helpful
    Regards
    Roberto

  • How to remove some thread from my threads

    Hi,
    recently I have send the request to approve my user account in TechNet. They are approve my account and my problem was solved. now the same thread so many users are give their command so each time new command arrived it will shown my unread threads. actually
    I don't want got the unread notification for that particular thread how can remove that from my profile.
    Thanks 
    Ravin Singh D

    Hi,
    There is not currently a way to remove a thread from your thread list, even if you delete your post from the thread.
    The verification threads do eventually get closed out, so it'll only be a matter of time before that thread no longer receives updates.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)
    This just goes to re-emphasize the foolishness of using the reportabug forum (or any forum) to implement the account verification.
    I personally don't use Alerts, so for me the worst part is the fact that these threads completely dominate the reportabug forum, rivaled only by off-topic threads that never seem to be moved promptly.
    David Wilkinson | Visual C++ MVP

  • How To Remove "Type" Column from Discoverer Worksheet List Portlet

    Is there a way to remove the "Type" column from Discoverer List of Worksheets portlet? I can see where to remove Modified Date, Creation Date, etc., but it doesn't from there allow me to remove the "Type" column. My users don't care whether it's a Workbook or Worksheet, and it's taking up valuable page real estate.
    Thanks!

    No and Yes.
    No because the UI does not provide you a way to do that. Because you can have in the List of Worksheets portlet different types of objects - workbooks as well as worksheets - we decided that it was going to be less confusing to people if they always got to see the type of object they would be opening if they clicked on the worksheet/workbook link.
    Yes because you can hack the appropriate UIX file to remove the lines that are responsible for displaying the Type column. But, and I cannot say this enough: do it at your own risk, it is not supported, and Oracle Support will be unable to help you should run into issues.
    Look for a step-by-step writeup on the blog later this week.
    Thanks
    Abhinav
    Oracle Business Intelligence Product Management
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    Discoverer: http://www.oracle.com/technology/products/discoverer/
    BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
    Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
    BI Samples: http://www.oracle.com/technology/products/bi/samples/
    Blog: http://oraclebi.blogspot.com/

  • How to remove some videos from my YouTube Favourites page?

    I want to remove some videos I have added to my YouTube Favorite.
    I was able to do that in IOS 5 but not in IOS 6.
    I cannot find the EDIT button on the FAVORITE videos screen.   I need that to delete the videos.

    Sorry, Diavonex - just clicked on the wrong reply - back to myself.
    The reply was for you -
    Thanks.
    It used to work and I would see the thumbnails wiggle with an X on each,
    which, when touched, would make that thumbnail disappear and the video
    removed.  I just can't make it work any more.

  • How to load empty column from flatfiles to tables in oracle using aql*loade

    HI,,
    i am trying to load data from flat files to oracle tables using sql*loader. i got empty column to load. while i am trying it is throwing an error as null colums canot load...
    plz help me with this...
    Thanks in adavnce..

    I believe you need to use 'trailing nullcols' as a parameter in your sql loader command.
    See example below:
    LOAD DATA
    INFILE *
    INTO TABLE load_delimited_data
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (  data1,
        data2
    BEGINDATA
    11111,AAAAAAAAAA
    22222,"A,B,C,D,"
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to insert columns in an existing table?

    iv read the tutorial in this site http://www.w3schools.com/sql/sql_alter.asp but it is not for SQL Server 2000 DB.
    Im using SQL Server 2000 DB. how do i insert column in an existing table?
    i tried to execute the code (String query) below but it doesn't wrk:
    For data type char:
    String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [char] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL";
    For data type int:
    String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [int] NOT NULL";________________________
    is what's wrong with the code?

    Best solution would be to look up the exact syntax from the SQL Server 2000 documentation. The tutorial you have there teaches the ANSI Standard SQL. It is surprising that SQL Server 2000 (Microsoft right?) doesn't comply with that (especially since they list it in as one of the ones the tutroial was made to demonstrate).
    I would double and triple check your sintax, whatch your error logs to make sure something else isn't preventing you from changing, and making sure you are logged in to the DB as a user who has the ability to alter tables.

  • How can I remove some themes from Keynote??

    How can I remove some themes from Keynote??

    What a co-incidence... I just deleted those same goodies. They were in /Library/Application Support/Keynote-folder on my machine. I just deleted the whole folder, cause there seemed to be nothing more but those downloaded files. And Keynote worked great afterwards. There seemed to be another folder for iWork09, which is not to be removed.

  • How do I delete some pages from an existing pdf file?

    I have an existing pdf file that is too large to send to some people. How can I delete some pages from this existing pdf file, and break it up into two files?

    Acrobat
    You can download a 30 day trial at that link.
    You may also be able to do it with CreatePDF, but I'm not sure.

  • How to create a table from an existing table with new column

    Hi !
    Please help me.
    I want to create a table from an existing table with data and add two new column to the new table.
    What will be the syntax?

    craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
    new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
    if you want to have VARCHAR2 instead of CHAR for example:
    SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
    Table created.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            CHAR(8)
    SQL> alter table new_dept modify (new_col varchar2(8));
    Table altered.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            VARCHAR2(8)Rgds.
    Didn't see michael's post - it reflects the fix for this problem using CAST.
    Message was edited by:
    dnikiforov

  • Can't figure out how to remove select music from my iPhone 4 with the new iTunes

    My old PC with all my music on iTunes died, and I need to remove some music from my iPhone 4 to make room for the new OS update. I downloaded iTunes on a different computer and tried to sync the iPhone to it, to move all the music on my iPhone to iTunes so I could deselect what songs I wanted to remove to make the storage space. I can't figure out how to do this with the new (non-user-friendly) iTunes update. When I sync the phone, the only songs that show up are the ones I have purchased on iTunes, but non of the songs/albums that I transfered from CDs. I don't want to reset my phone to delete ALL my music, just select songs/albums. Can anyone please help me figure out the new iTunes to be able to do this? It is driving me nuts and I'm getting really mad at Apple for their constant updates making things less easy to use!

    i have the same problem, if u find it out please let me know :C i can erase or put new songs from my pc to itunes u.u

  • How to export some data from the tables of an owner with integrity?

    Hi to all,
    How to export some data from the tables of an owner with integrity?
    I want to bring some data from all tables in a single owner of the production database for development environment.
    My initial requirements are: seeking information on company code (emp), contract status (status) and / or effective date of contract settlement (dt_liq_efetiva) - a small amount of data to developers.
    These three fields are present in the main system table (the table of contracts). Then I thought about ...
    - create a temporary table from the query results table to contract;
    - and then use this temporary table as a reference to fetch the data in other tables of the owner while maintaining integrity. But how? I have not found the answer, because: what to do when not there is the possibility of a join between the contract and any other table?
    I am considering the possibility of consulting the names of tables, foreign keys and columns above, and create dynamic SQL. Conceptually, something like:
    select r.constraint_name "FK name",
    r.table_name "FK table",
    r.column_name "FK column",
    up.constraint_name "Referencing name",
    up.table_name "Referencing table",
    up.column_name "Referencing column"
    from all_cons_columns up
    join all_cons_columns r
    using (owner, position), (select r.owner,
    r.constraint_name fk,
    r.table_name table_fk,
    r.r_constraint_name r,
    up.table_name table_r
    from all_constraints up, all_constraints r
    where r.r_owner = up.owner
    and r.r_constraint_name = up.constraint_name
    and up.constraint_type in ('P', 'U')
    and r.constraint_type = 'R'
    and r.owner = 'OWNERNAME') aux
    where r.constraint_name = aux.fk
    and r.table_name = aux.table_fk
    and up.constraint_name = aux.r
    and up.table_name = aux.table_r;
    -- + Dynamic SQL
    If anyone has any suggestions and / or reuse code to me thank you very much!
    After resolving this standoff intend to mount the inserts in utl_file by a table and create another program to read and play in the development environment.
    Thinking...
    Let's Share!
    My thanks in advance,
    Philips

    Thanks, Peter.
    Well, I am working with release 9.2.0.8.0. But the planning is migrate to 10g this year. So my questions are:
    With Data Pump can export data just from tables owned for me (SCHEMAS = MYOWNER) parameterizing the volume of data (SAMPLE) and filters to table (QUERY), right? But parameterizing a contract table QUERY = "WHERE status NOT IN (2,6) ORDER BY contract ":
    1º- the Data Pump automatically searches for related data in other tables in the owner? ex. parcel table has X records related (fk) with Y contracts not in (2,6): X * SAMPLE records will be randomly exported?
    2º- for the tables without relation (fk) and which are within the owner (MYOWNER) the data is exported only based on the parameter SAMPLE?
    Once again, thank you,
    Philips
    Reading Oracle Docs...

Maybe you are looking for