Drop column in sql - sql - sql tutorial - learn sql




 sql drop table
  • The DROP TABLE statement is used to drop an existing table in a database.
  • We can remove the data with column use the do command to do it.
  • Sometimes we will wish to delete a column from an existing table in SQL. To do this, we specify that we want to change the table structure via the ALTER TABLE command, followed by a specification indicating that we want to remove a column.
  • The detailed syntax for each database is as follow:
  • In MySQL, the syntax for ALTER TABLE Drop Column is,
ALTER TABLE "table_name"
DROP "column_name";
  • In Oracle and SQL Server, the syntax for ALTER TABLE Drop Column is,
ALTER TABLE "table_name"
DROP COLUMN "column_name";
  • Let's look at the example. Assuming our starting point is the Employee table created in the CREATE TABLE section:

Table Employee

Column Name Data Type
First_Name char(50)
Last_Name char(50)
Address char(50)
City char(50)
Country char(25)
Birth_Date datetime
  • Our goal is to drop the "Birth_Date" column. To do this, we key in:

MySQL:

ALTER TABLE Employee DROP Birth_Date;

SQL Server:

ALTER TABLE Employee DROP COLUMN Birth_Date;

Oracle:

ALTER TABLE Employee DROP COLUMN Birth_Date;
  • The resulting table structure is:

Table Employee

Column Name Data Type
First_Name char(50)
Last_Name char(50)
Address char(50)
City char(50)
Country char(25)

This tutorial provides more the basic needs and informations on sql tutorial , pl sql tutorial , mysql tutorial , sql server , sqlcode , sql queries , sql , sql formatter , sql join , w3schools sql , oracle tutorial , mysql , pl sql , learn sql , sql tutorial for beginners , sql server tutorial , sql query tutorial , oracle sql tutorial , t sql tutorial , ms sql tutorial , database tutorial , sql tutorial point , oracle pl sql tutorial , oracle database tutorial , oracle tutorial for beginners , ms sql server tutorial , sql tutorial pdf

Related Searches to Drop column in sql

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×