MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 22nd, 2000, 10:13 AM
terium terium is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 60 terium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to terium
I just made a table using "CREATE TABLE asdf (...);", and I forgot to specify the primary key. Also, how do I ADD/DELETE more columns? Thanks..

Nelson

Reply With Quote
  #2  
Old June 22nd, 2000, 10:57 AM
releasedj releasedj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: London
Posts: 46 releasedj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
You need to use the 'ALTER TABLE' statement.
To change a coloumn it's;

ALTER TABLE tablename MODIFY columnname column properties

ie:

ALTER TABLE user MODIFY id INT(11) PRIMARY KEY;

To add a column use ADD;

ALTER TABLE user ADD password VARCHAR(15) ...etc.

Kelvin.

Reply With Quote
  #3  
Old June 22nd, 2000, 11:04 AM
terium terium is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 60 terium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to terium
OK, thanks. All the tutorials I found only told you how to CREATE, but not EDIT.. Now I suppose that to delete a column (for future reference) I use "ALTER TABLE tablename DELETE columnname"?

Reply With Quote
  #4  
Old June 22nd, 2000, 11:17 AM
releasedj releasedj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: London
Posts: 46 releasedj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Use;

ALTER TABLE tablename DROP columnname;

Kelvin

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Delete/Change table info (beginner)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway