SQLite DROP COLUMN Keyword
The SQLite DROP COLUMN keyword is used to a delete columns from an existing table.
Syntax
The syntax for using DROP COLUMN keyword to drop columns in SQLite is given below:
ALTER TABLE table_name DROP COLUMN column_name;
Example:
Consider a database table called Employee with the following records:
EmpID | Name | City | Age | Salary |
---|---|---|---|---|
1 | John | London | 25 | 3000 |
2 | Marry | New York | 24 | 2750 |
3 | Jo | Paris | 27 | 2800 |
4 | Kim | Amsterdam | 30 | 3100 |
5 | Ramesh | New Delhi | 28 | 3000 |
6 | Huang | Beijing | 28 | 2800 |
DROP COLUMN
To drop the Salary column from the Employee table, the following statement can be used:
ALTER TABLE Employee DROP COLUMN Salary; --see the result SELECT * FROM Employee;
This will produce the below mentioned result:
EmpID | Employee | City | Age |
---|---|---|---|
1 | John | London | 25 |
2 | Marry | New York | 24 |
3 | Jo | Paris | 27 |
4 | Kim | Amsterdam | 30 |
5 | Ramesh | New Delhi | 28 |
6 | Huang | Beijing | 28 |
❮ SQLite Keywords