You are on page 1of 1

MERGE STATEMENT

select * from movies


select * from moviesTes

merge moviesTes mt
using movies m
on mt.mid=m.mid
when matched then
update set mt.mname=m.mname
when not matched then
insert (Mid, Mname, Amount) values(m.Mid, m.Mname, m.Amount);

Add primary key constraint

alter TABLE moviesTes


ADD CONSTRAINT PK_moviesTes PRIMARY KEY (MID) ;

You might also like