General discussion

Locked

how to enter data in a new column of existing table

By marora80 ·
hello
actually i am very new in database and now i am using sql-plus from oracle 9i. i have a table named as student which has three columns named with statement.
create table student (name (varchar(15), rollno(number(5), class(varchar(10));
the i have inserted values in the first row of the table as per the datatypes using insert into statement.
after that i have altered the table and add a new column named fee using the statement
alter table student add (fee number(5);
but now on insertion a value in fee column inserts it to 2nd row but i want to insert the value in the first row(because the value of fee is still blank in first row) under fee column.
how it is possible please send me the full qurey for that.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Comments

Collapse -

You insert rows, the statement you want is

by Tony Hopkinson In reply to how to enter data in a ne ...

Update Student set fee = 1250 Where ....

What comes after where depends on what your primary key is.

e.g.

Where Name = 'Smith' and Rollno = 1 and Class = 'Database'

If for instance RollNo is effectively student ID, then

Where RollNo = 1

or what ever rollno is in your 'first' row.

Would uniquely identify the row you wanted to change.

HtHs

PS

Be real careful about first ,last, in fact any position in a result set, as soon as that becomes significant you have problems

ItemID, ItemType, ItemDescription
1,'E','DVD Player'
2,'M' 'Rippers'
3,'A','Blank Disc'

If ItemID is the primary key

Then
Select * from Items gives 1 as first
Select * From Items Where ItemID > 2 gives 2 as first

Select * From Items Order By ItemType 3 is first.

To rely on order you need something extra, like a DisplayOrder column, or DateTimeEntered.


HtHs

Back to IT Employment Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums