Search code examples
sqlaltersql-drop

SQL ALTER DROP query not working


I am learning SQL online from w3school.com.

for droping a column
ALTER TABLE table_name DROP COLUMN column_name command is given in SQL ALTER page

i tried it in Try it yourself section provided by w3school.
but it's not working

I used

ALTER TABLE Customers
DROP COLUMN City;

I also try to do this query on compile online/sql.
but again it's not working.

so, can any one explain me where i am wrong.


Solution

  • Did you notice what it says in the brackets?

    To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column)

    See the answers to these questions:

    websql drop column with javascript

    How to delete or add column in SQLITE?

    W3schools uses websql. Try SQLFiddle instead.