technical skills grow

Responsive Ads Here

Friday, December 3, 2021

PostgreSQL ALTER table

 

PostgreSQL ALTER TABLE


Add column 
alter table employee_clone add column dept_id integer ;

Change data type

alter table employee_clone alter column dept_id type numeric;

Rename column 
alter table employee_clone rename column dept_id to dept ;

Drop column 
 
alter table employee_clone drop column  dept

Set Default column 

alter table employee_clone add column  dept integer  default 1 ;

Set Primary key 

alter table employee_clone add primary key (empid) ;

alter table employee_clone add column Age int check ( Age > 0 )  default 20

Rename table 

alter table employee_cl rename to emp ;

No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts