Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

SQL columns

  1. Jan 6, 2005 #1
    Isn't possible to delete and remove columns after a table has been created?
    Rows works just fine but columns don't...
  2. jcsd
  3. Jan 6, 2005 #2
    in MySQL, this is done with http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html [Broken]
    Last edited by a moderator: May 1, 2017
  4. Jan 6, 2005 #3
    Note that columns and rows in a database are very different things, so the fact that you can do something to a row doesn't automatically mean you should be able to do the same thing to a column.

    Still, any good database should allow you to delete a column unless you've deliberately added constraints that would prevent it. But you have to modify the table to do that, usually with an ALTER TABLE statement.
  5. Jan 6, 2005 #4
    You can, but its not considered a good thing to do, except possibly when prototyping. This is because you are altering your schema, which shouldn't happen. Would you want to alter the form of a data structure at runtime?
  6. Jan 7, 2005 #5
    If your schema is wrong, why wouldn't you change it?
  7. Jan 7, 2005 #6
    It is a DDL command and is language specific.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook