Results 1 to 6 of 6

Thread: operation column positions in database

  1. #1
    Join Date
    Apr 2008
    Posts
    242

    operation column positions in database

    Hello,
    I created a table which have three columns and need to add more columns but I am unable to do it,how would I perform it an done question is also clicking in my mind that The position of the columns are managed by the way of sequence as a column name during the creation of table which is managed by database automatically.Can We change the position of the columns in the table.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Changing the position of columns in database

    Changing the position of columns in database

    When a database table is created,it contains different columns as per the user desire that how much columns he is creating for a particular table.
    You are talking about the positions of the column means the table is created with 3 columns and you need to swap the sequence of columns for the table.

    Then it can be using ALTER SYSTEM statement or different way which you also can search within your mind using the copying or cloning of the database table.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    changing column positions in database

    Changing column positions in database

    Absolutely,you can change the position of the columns in the table but one thing I would like to know that why you need this concept.Whatever,you have posted and consider such a good thing.

    you can chnage the positiojn of columns to make the different copy of the existing table.The query to create a new column would be as follows:

    Code:
    SQL> create table New_tab as select col_3, col_0, col_1, col_2 from Prev_tab;
    
    SQL> drop table Prev_tab;
    
    SQL> rename New_tab to Prev_tab;

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Adding columns in database table

    Adding columns in database table

    To add more columns in the database tables,you need to use the ALTER command,basically the ALTER command is used to change the structure of the database object or database itself.The ALTER command associated with DDL category.

    To add one more column to the database table,we will do as follows:

    Code:
    ALTER TABLE Prev_tab
     ADD sup_name  varchar2(50);
    Now the sup_name would be another column which is recently added with prev_table.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Modifying column of table in database

    Modifying column of table in database:

    You can modify the existing column of the table.The modification of the columns seems as you can change the data type,size and overall behavior of the column.

    Again the ALTER command would be used to change the size and datatype of a particular column of the table but will be associated with MODIFY.

    Suppose,I have a table named Zachine_Contact and need to modify the contact column as a VARCHAR2 and column can contain 15 values maximum.

    Code:
    ALTER TABLE Zachine_Contact
     MODIFY contact VARCHAR2(15);

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Renaming column of table in database

    Renaming column of table in database :::

    You can change the the whole structure using the ALTER statement for a database table but you can't change the name of column but another facility is provided by database,you can change it using ALTER statement but that would be associated with RENAME command and takes the following form to address itself successfully.

    The command to rename a column as shown:

    Code:
    ALTER TABLE table_name
     RENAME COLUMN old_name to new_name;

Similar Threads

  1. How to get better positions in Google searches
    By The creeper in forum Technology & Internet
    Replies: 3
    Last Post: 20-01-2011, 11:07 PM
  2. Replies: 3
    Last Post: 09-12-2009, 01:11 PM
  3. How to save window positions in windows 7
    By Gomeler in forum Operating Systems
    Replies: 3
    Last Post: 02-12-2009, 01:47 PM
  4. mysql update column with another column
    By Gunter in forum Software Development
    Replies: 3
    Last Post: 23-05-2009, 09:44 AM
  5. How can I bind textbox with column in SQL database?
    By SushmitaP in forum Software Development
    Replies: 3
    Last Post: 19-02-2009, 10:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,632,226.80501 seconds with 17 queries