DISQUS

Tech-Recipes: Add a column to an existing MySQL table | MySQL | Tech-Recipes

  • nilesh · 1 year ago
    Thanks. it helped me.
  • Philip · 1 year ago
    Wow, that's kind of stupid that there's no before.
  • James · 1 year ago
    Why do you need a before? If its the first one, you use first, if its the second one, you use after first.
  • ally · 8 months ago
    wow, you have no idea what you're talking 'bout
  • fubar · 1 year ago
    nice
  • Mike · 11 months ago
    Thus why philip will never design anything worth while. Positive thinking is needed to create great things .... :P
  • Parkash · 11 months ago
    Wow what a solution!
  • KG Old Wolf · 11 months ago
    Actually "HEAD FIRST SQL" (book by O'Rielly publications) states there is "BEFORE, AFTER, FIRST, SECOND, THIRD" but I can only get FIRST and AFTER to work using MySQL 5.1

    That's why I came here for a different opinion.

    I think the book is wrong :(
  • BaZ · 10 months ago
    Try looking at MySQL refman page:
    http://dev.mysql.com/doc/refman/5.1/en/alter-ta...
    The location, if present, must be "FISRT" or "AFTER column", there is no other option.

    If the book is about MySQL 5.1 its really wrong, but isn t it about ANSI SQL or anything else?
  • bob · 9 months ago
    This is just perfect, I use it all the time ... thx!
  • gb · 9 months ago
    Thanks!
  • gnujack · 7 months ago
    Thanks, exactly what I was looking for!
  • mike · 7 months ago
    "...with a datatype of VARCHAR(80), use the..." then you say "...ADD email VARCHAR(60)" what i'm getting at here is 80 then 60. small typo.
  • andy · 6 months ago
    @KG - SQL comes in many flavors. PregreSQL and MySQL and MS SQLServer all use slightly different variations on SQL, with varying support for various language constructs. I can only assume they are all derived from some original SQL language specification.
  • kannika · 4 months ago
    I want to learn about the space that data take in mysql
  • English · 3 months ago
    Thanks for that info, that really helps me to create my first ALTER ADD COLUMN =)
  • grvijaya · 3 months ago
    good example
  • milnd · 1 month ago
    thanks
  • sasimkumar · 1 month ago
    Thanks for the information..
  • favrefan4 · 1 week ago
    How do you add a value to the new column?
  • my_ls_kumar · 2 days ago
    First time in this site. It seems helpful