i am using navicat8 for MySQL for writing trigger, bellow is my trigger statement.
insert into two(name,curdate())
select name from one
but it will display error while saving trigger.
You should specify the name of the column instead of passing CURDATE()
.
Use the following syntax,
insert into two (name, colName)
select name, CURDATE()
from one
UPDATE 1
So here's what you are going to do.
UNIQUE
constraint on column Name
on table two
.To alter the table,
ALTER TABLE tableNamehere ADD CONSTRAINT two_uq UNIQUE(name);
insert into two(name, date_col)
select name, curdate()
from one
First you have to name the columns you want to insert into, and then the values. If you want to fill all columns from your table you can leave the column name part and do
insert into two
select name, curdate()
from one