User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 375,263 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,218 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser:
Views: 3793 | Replies: 3
Reply
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,924
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 221
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

Add an attribute to existing table

  #1  
Apr 23rd, 2005
I am supposed to write an query which will add new attribute to my already existing table
So I written this

ALTER TABLE member
ADD e_mail CHAR(20)


which is fine, however when I try insert required data for each row I get stuck

INSERT INTO member(e_mail) VALUES('johnwhite@msn.com');

Can anyone help me please....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,924
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 221
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

Re: Add an attribute to existing table

  #2  
Apr 24th, 2005
After all I found my lost way trough the darknest and here is my final code
ALTER TABLE member
ADD e_mail CHAR(20);

UPDATE member SET e_mail='johnwhite@msn.com' WHERE member_no='A2345';
UPDATE member SET e_mail='leeJulie@aol.com' WHERE member_no='R3456';
UPDATE member SET e_mail='d_ford@yahoo.com' WHERE member_no='S4567';
UPDATE member SET e_mail='maryhowe@aol.co.uk' WHERE member_no='S7654';
UPDATE member SET e_mail='mrobinson@msn.com' WHERE member_no='A7412';
UPDATE member SET e_mail='ahmed_h@msn.co.uk' WHERE member_no='B6421';
UPDATE member SET e_mail='AnnMat@f2s.com' WHERE member_no='A1246';
UPDATE member SET e_mail='amohammady@box.com' WHERE member_no='R8916';
UPDATE member SET e_mail='fairyjack@aol.com' WHERE member_no='S1248';


Hope I will pass my module :lol:
Reply With Quote  
Join Date: Jan 2005
Posts: 22
Reputation: haria_kishore is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
haria_kishore haria_kishore is offline Offline
Newbie Poster

Re: Ass an attribute to existing table

  #3  
Apr 27th, 2005
Dear friend

The only way you can insert data (or in other words update ur table with new data) is by using UPDATE command followed by some condition.

And have u used TOAD( a software for viewing sql data in a neat format unlike SQL* plus).I think that will make ur life a bit easy as well for updating large volumes of data in near future
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,924
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 221
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

Re: Ass an attribute to existing table

  #4  
Apr 30th, 2005
Thanks for interest.
As you can see this was part of my coursework. I must admit that to learn SQL was interesting experience however the course hasn't got appropriate backup. What I mean, our tutor answers been often confusing, not to much in notes and tutorials did not provide enought experience, for example to insert data in new attribute. Only think close to this for us was update already existing data. In the proces of learning it logicly come to me to do it exactly as populating table with INSERT INTO.
Now I know, I was wrong.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Database Design Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Database Design Forum

All times are GMT -4. The time now is 5:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC