SQL Alter Command

Advertisements

Insert Command in SQL Delete Command in SQL

SQL Alter Command

Alter Command is used to modify the structure of the table. Using this command you can perform four different operations. This command contains four sub commands that is;

  • Alter modify
  • Alter add
  • Alter rename
  • Alter drop

Alter modify

Using this command you can increase or decrease the size of data type and also you can change the data type from old data type to new data type.

Syntax

	
ALTER TABLE table_name MODIFY 
(
column 1 datatype(size),
column 2 datatype(size),
.........
);

Example

	
ALTER TABLE Employee MODIFY 
(
emp_name varchar(30),
);

Alter add

This command is used to add a new column in the table. Using this command you can add more than one column to the existing.

Syntax

	
ALTER TABLE table_name ADD 
(
column 1 datatype(size),
column 2 datatype(size),
.........
);

Example

	
ALTER TABLE Employee ADD 
(
emp_age number(5),
);

Note: You can not add the new column at required position in the table.

Alter rename

This command is used to change the column name from old column name to new column name.

Syntax

	
ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name;

Example

	
ALTER TABLE Employee RENAME salary to employee_salary;

Note: You can not change more than one column name at a time.

Alter drop

This command is used to remove the column from existing table.

Syntax

	
ALTER TABLE table_name DROP column_name;

Example

	
ALTER TABLE Employee DROP emp_name;

Insert Command in SQL Delete Command in SQL

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Download Projects

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements