|
Home >> FAQs/Tutorials >> MySQL Tutorials
MySQL Tutorial - Delete an Existing Column in a Table
By: FYIcenter.com
(Continued from previous topic...)
How To Delete an Existing Column in a Table?
If you have an existing column in a table and you do not need that column
any more, you can delete it with "ALTER TABLE ... DROP COLUMN" statement.
Here is a tutorial script to delete an existing column:
mysql> ALTER TABLE tip DROP COLUMN create_date;
Query OK, 1 row affected (0.48 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM tip;
+----+-------------+-------------------------+--------+
| id | subject | description | author |
+----+-------------+-------------------------+--------+
| 1 | Learn MySQL | Visit dev.fyicenter.com | NULL |
+----+-------------+-------------------------+--------+
1 row in set (0.00 sec)
As you can see the column "create_date" is gone.
(Continued on next topic...)
- What Are DDL Statements?
- How To Create a New Table?
- What Happens If You No CREATE Privilege in a Database?
- How To Get a List of All Tables in a Database?
- How To Get a List of Columns in an Existing Table?
- How To See the CREATE TABLE Statement of an Existing Table?
- How To Create a New Table by Selecting Rows from Another Table?
- How To Add a New Column to an Existing Table?
- How To Delete an Existing Column in a Table?
- How To Rename an Existing Column in a Table?
- How To Rename an Existing Table?
- How To Drop an Existing Table?
- How To Create an Index for a Given Table?
- How To Get a List of Indexes of a Given Table?
- How To Drop an Existing Index?
- How To Create a New View?
- How To Drop an Existing View?
|