Prepare for your Next Interview
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 ...
|
|||
|
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 |
| Sponsored Links |
|
|||
|
Re: How to add values to other columns
Quote:
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. |
|
|||
|
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. |
|
|||
|
Re: How to add values to other columns
Quote:
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:-) |
|
|||
|
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.
|
| The Following User Says Thank You to reetasharma108 For This Useful Post: | ||
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| 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 |