0

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.

Kara
  • 6,115
  • 16
  • 50
  • 57
singhiskng
  • 511
  • 1
  • 5
  • 15

3 Answers3

1

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.

Community
  • 1
  • 1
kintoki
  • 318
  • 2
  • 11
0

try like this:

    use 'DatabaseName';
    ALTER TABLE Customers
    DROP COLUMN City;
    enter code here
0

The 'try it yourself' link you provided seems to be set up for testing a 'Select all' statement. It may not be a fully functional environment, and you may not have permission to run all statements.

JamieA
  • 1,984
  • 4
  • 27
  • 38