Removing Columns After Table Creation Using SQL

AI Thread Summary
In MySQL, it is indeed possible to delete columns from a table after it has been created, but this requires using the ALTER TABLE statement. Unlike rows, which can be easily manipulated, columns are more complex due to their role in the database schema. While good database practices allow for column deletion, it is generally discouraged outside of prototyping scenarios because altering the schema can lead to issues in data integrity and application stability. Modifying the schema at runtime raises concerns about the reliability of the data structure. However, if the schema is incorrect, making changes is justified, as it is a Data Definition Language (DDL) command that is specific to the database language being used.
ponjavic
Messages
221
Reaction score
0
Isn't possible to delete and remove columns after a table has been created?
Rows works just fine but columns don't...
 
Computer science news on Phys.org
in MySQL, this is done with http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html
 
Last edited by a moderator:
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.
 
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?
 
so-crates said:
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?

If your schema is wrong, why wouldn't you change it?
 
It is a DDL command and is language specific.
 
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top