Adding fields to Mysql table?

Discussion in 'MySQL' started by smartcard, Jan 18, 2007.

  1. #1
    I have a MySql database table, where I need to add the following fields, Please tell me how can I do it with PhpMyadmin?

    `DetailedDesc` text NOT NULL,
    `Price` float(15,2) NOT NULL default '0.00',
    `image` text NOT NULL,
     
    smartcard, Jan 18, 2007 IP
  2. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #2
    view the structure of the table. Below that is an "add field" dialog. It's pretty easy in phpmyadmin.
     
    noppid, Jan 18, 2007 IP
  3. smartcard

    smartcard Well-Known Member

    Messages:
    278
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    Thanks, I know that but what I want to know is if there is a SQL command I can run to automatically create these field?
     
    smartcard, Jan 18, 2007 IP
  4. phantomddl

    phantomddl Well-Known Member

    Messages:
    2,856
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    160
    Articles:
    15
    #4
    i think it can be done with "alter table" command, i cant remember the usage now
     
    phantomddl, Jan 18, 2007 IP
  5. javafreak

    javafreak Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    phantomddl is right the 'ALTER TABLE' command should work, something like:
    ALTER TABLE customers ADD COLUMN address VARCHAR(30);
     
    javafreak, Jan 18, 2007 IP
  6. technoguy

    technoguy Notable Member

    Messages:
    4,369
    Likes Received:
    306
    Best Answers:
    0
    Trophy Points:
    205
    #6
    use alter table command to add fields

    Alter table <table name> add (field name, type.....);

    thats all
     
    technoguy, Jan 18, 2007 IP