Geeks Talk

Prepare for your Next Interview




How to add values to other columns

This is a discussion on How to add values to other columns within the Oracle forums, part of the Databases category; Table with 8 columns. One row with only two columns have values other don't. How to add values to other columns? UPDATE TABLE, INSERT INTO TABLE, ALTERTABLE? I know ...


Go Back   Geeks Talk > Databases > Oracle

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-13-2007
Junior Member
 
Join Date: May 2007
Location: Canada
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Mohamed_Rafi is on a distinguished road
How to add values to other columns

Table with 8 columns. One row with only two columns have values other don't. How to add values to other columns?

UPDATE TABLE, INSERT INTO TABLE, ALTERTABLE?

I know how to do it with 'Update' and 'Insert into'.
I don't know how to do with 'Alter Table'.

Can any one answer my question please?

Thanks in advance
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-15-2007
Contributing Member
 
Join Date: Jan 2007
Location: india
Posts: 41
Thanks: 7
Thanked 3 Times in 3 Posts
aardvax is on a distinguished road
Re: How to add values to other columns

Quote:
Originally Posted by Mohamed_Rafi View Post
Table with 8 columns. One row with only two columns have values other don't. How to add values to other columns?

UPDATE TABLE, INSERT INTO TABLE, ALTERTABLE?

I know how to do it with 'Update' and 'Insert into'.
I don't know how to do with 'Alter Table'.

Can any one answer my question please?

Thanks in advance
Hi Rafi

Use this query and solve your problem

UPDATE table_name
SET column_name(which is to be updated) = new_value
WHERE column1_name(any existing column) = any existing value;

NOte: the new_value if is a number then there is no need to put it in single quotes but if the data type of that column(to be updated) is VARCHAR2 then put the new_value in single quotes.
Reply With Quote
  #3 (permalink)  
Old 05-15-2007
Contributing Member
 
Join Date: Apr 2007
Location: bangalore
Posts: 46
Thanks: 0
Thanked 9 Times in 9 Posts
reetasharma108 is on a distinguished road
Re: How to add values to other columns

Hi Rafi,

As alter is a DDL command,you can not manipulate the table using alter.if you have to add one more column in table then u can make use of this.

but if you want to fill the columns of the table then you must have to use DML commands that is INSERT or UPDATE.
Reply With Quote
  #4 (permalink)  
Old 05-15-2007
Contributing Member
 
Join Date: Jan 2007
Location: india
Posts: 41
Thanks: 7
Thanked 3 Times in 3 Posts
aardvax is on a distinguished road
Re: How to add values to other columns

Quote:
Originally Posted by reetasharma108 View Post
Hi Rafi,

As alter is a DDL command,you can not manipulate the table using alter.if you have to add one more column in table then u can make use of this.

but if you want to fill the columns of the table then you must have to use DML commands that is INSERT or UPDATE.
hi reeta
i jus thought that if we want to insert(not as SQL command) values into a particular cell then then it is better to use UPDATE as INSERT will add a row to the (means a record to the table)..
please correct me if i am wroooooooooong:-)
Reply With Quote
  #5 (permalink)  
Old 05-15-2007
Contributing Member
 
Join Date: Apr 2007
Location: bangalore
Posts: 46
Thanks: 0
Thanked 9 Times in 9 Posts
reetasharma108 is on a distinguished road
Re: How to add values to other columns

ya.if u want to fill a colum u have to use update and for inserting new row then use insert.
Reply With Quote
The Following User Says Thank You to reetasharma108 For This Useful Post:
  #6 (permalink)  
Old 07-04-2007
Junior Member
 
Join Date: Feb 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
karthikeyanrr76 is on a distinguished road
Re: How to add values to other columns

Alter is a DDL command,you can not manipulate the table using alter. Need to use either update or insert into query to fill other column values.
Reply With Quote
  #7 (permalink)  
Old 07-05-2007
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,432
Thanks: 8
Thanked 125 Times in 112 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: How to add values to other columns

before i tell u how to do that using ALTER command can u please tell me how can u do the same using INSERT.
Reply With Quote
  #8 (permalink)  
Old 07-07-2007
Junior Member
 
Join Date: Jul 2007
Location: delhi
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
himanshusinha1 is on a distinguished road
Re: How to add values to other columns

hi i m ur friends please first write craete table something as select from that table name and write field name also
Reply With Quote
  #9 (permalink)  
Old 03-26-2008
Junior Member
 
Join Date: Mar 2008
Location: BANGALLORE
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
geetu rani is on a distinguished road
Smile Re: How to add values to other columns

hi


ALTER TABLE table_name
ADD column_name datatype

or

INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)

or

UPDATE table_name
SET column_name = new_value
WHERE column_name = some_value
Reply With Quote
  #10 (permalink)  
Old 03-27-2008
Contributing Member
 
Join Date: Nov 2007
Location: India
Posts: 63
Thanks: 5
Thanked 8 Times in 7 Posts
sreekumar_nair_it is on a distinguished road
Re: How to add values to other columns

Hello Friend,

Just go through this link once.

[BR]Database Design - DDL & DML[BR]

I hope you will get your answer here.

Have a pleasant time.
Reply With Quote
  #11 (permalink)  
Old 03-27-2008
Junior Member
 
Join Date: Mar 2008
Location: Bangalore
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ManjuPillae is on a distinguished road
Re: How to add values to other columns

The solution to your problem is using update command, as you know how to use update command no problem to find solution, just identify the unique row that is to be altered and update that column.
Main purpose of alter command is used to alter the columns of the existing table.

Syntax:
alter table table_name add column_name datatype
example: alter table person add city varchar(30)

Syntax:
alter table table_name drop column column_name
example: alter table person drop column address

and insert will create a new row into the exsiting table.

Last edited by ManjuPillae : 03-27-2008 at 12:42 AM.
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Getting properties and values of MENU Geek_Guest QTP 1 12-21-2007 07:40 PM
Joining Tables and mapping columns JobHelper SQL 1 08-20-2007 02:30 PM
Retrieve values in different format Geek_Guest Oracle 1 07-12-2007 08:02 AM
I need to check some values in the MS-Word Geek_Guest QTP 2 04-20-2007 01:21 PM
System field to get the sum of the values in SAP mmohanmbb SAP R/3 0 04-15-2007 06:11 AM


All times are GMT -4. The time now is 02:04 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved