add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table lehrer(
Vorname varchar(10),
teacherDate date,
eingabeDatum date
);
insert into lehrer values
('Erika','2022-01-01','2010-04-05'),('Tobias','2022-01-01','2010-04-05'),('John','2022-01-01','2010-04-05');
update lehrer
set eingabeDatum =
concat(
year(teacherDate) ,'-',
month(eingabeDatum),'-',
day(eingabeDatum)
)
WHERE Vorname = 'Erika';
UPDATE lehrer
SET eingabeDatum =
DATE_ADD(DATE_FORMAT(eingabeDatum, '0000-%m-%d'), INTERVAL YEAR(teacherDate) YEAR)
WHERE Vorname = 'Tobias';
UPDATE lehrer
SET eingabeDatum =
DATE_FORMAT(
eingabeDatum,
concat(
YEAR(teacherDate),
'-%m-%d')
)
WHERE Vorname = 'John';
select * from lehrer;
Vorname teacherDate eingabeDatum
Erika 2022-01-01 2022-04-05
Tobias 2022-01-01 2022-04-05
John 2022-01-01 2022-04-05