Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



operation column positions in database

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 24-02-2010
Member
 
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.

Reply With Quote
  #2  
Old 24-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,946
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.
Reply With Quote
  #3  
Old 24-02-2010
Member
 
Join Date: May 2008
Posts: 2,004
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;
Reply With Quote
  #4  
Old 24-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,997
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.
Reply With Quote
  #5  
Old 24-02-2010
Member
 
Join Date: May 2008
Posts: 2,286
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);
Reply With Quote
  #6  
Old 24-02-2010
Member
 
Join Date: Oct 2005
Posts: 2,387
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;
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "operation column positions in database"
Thread Thread Starter Forum Replies Last Post
How to get better positions in Google searches The creeper Technology & Internet 3 20-01-2011 10:07 PM
How to highlight identical cell value of one column in another column? D_chapple Windows Software 3 09-12-2009 12:11 PM
How to save window positions in windows 7 Gomeler Operating Systems 3 02-12-2009 12:47 PM
mysql update column with another column Gunter Software Development 3 23-05-2009 09:44 AM
How can I bind textbox with column in SQL database? SushmitaP Software Development 3 19-02-2009 09:57 PM


All times are GMT +5.5. The time now is 04:09 AM.