문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

try like this:

    use 'DatabaseName';
    ALTER TABLE Customers
    DROP COLUMN City;
    enter code here
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top