#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    60
    Rep Power
    15
    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    London
    Posts
    46
    Rep Power
    15
    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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    60
    Rep Power
    15
    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"?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    London
    Posts
    46
    Rep Power
    15
    Use;

    ALTER TABLE tablename DROP columnname;

    Kelvin

Similar Threads

  1. Selecting info from a table to outfile
    By bryricha in forum MySQL Help
    Replies: 2
    Last Post: September 20th, 2003, 02:50 AM
  2. How do I Generate Access 200 Db from script?
    By johnnyr77 in forum Database Management
    Replies: 0
    Last Post: September 1st, 2003, 05:45 PM
  3. Creating a linking table?
    By wupulamp in forum PostgreSQL Help
    Replies: 1
    Last Post: June 12th, 2003, 05:19 PM
  4. help on 3 table join query?
    By smakz in forum Database Management
    Replies: 1
    Last Post: November 19th, 2002, 04:00 AM
  5. ODD: Only seeing two columns of info in a select * from table
    By shannonDavis in forum PHP Development
    Replies: 2
    Last Post: August 12th, 2002, 11:19 AM

IMN logo majestic logo threadwatch logo seochat tools logo