
Posted on: 7 months ago
How to drop/delete a column in an existing table in MySQL database?
Column, Database, Drop, MySQL, Table
75 | 0 | 0
We can use ALTER TABLE statement to drop/delete a column in an existing table.
Syntax:
ALTER TABLE <table_name> DROP COLUMN <column_name>;
Example:
// Create table
CREATE TABLE employees (
id int,
first_name varchar(255),
last_name varchar(255),
email varchar(255),
City varchar(255),
state varchar(255),
country varchar(255),
zip_code varchar(10)
);
// Alter table to drop zip_code column
ALTER TABLE employees DROP COLUMN zip_code;
Welcome to CodePits.
CodePits provide a collection of tutorials about many programming languages like PHP, Laravel Framework, Codeigniter Framework, Mysql Database, Bootstrap Front-end Framework, Jquery, Node JS, Ajax Example, APIs, CURL Example, Composer Packages Example, AngularJS, Ionic Framework, etc. 🙌
Other Posts
Categories
Tags
Comment
Comments (0)
🤔
No comments yet, be the first to help
load more