clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3798782 fiddles created (41849 in the last week).

create table users ( email varchar2(32) unique , name varchar2(32) , id number );
 hidden batch(es)


create table user_details ( username varchar2(32) , address varchar2(64) , details varchar2(64) , email varchar2(64) , user_id number );
 hidden batch(es)


insert all into users (email, name, id) values ('user.mail1@domain.org','name_1',1) into users (email, name, id) values ('user.mail2@domain.org','name_2',2) into users (email, name, id) values ('user.mail3@domain.org','name_3',3) -- into user_details (username, address, details, email, user_id) values ('name1','address_1','details_1','user.mail1@domain.org',null) into user_details (username, address, details, email, user_id) values ('name2','address_2','details_2','user.mail2@domain.org',null) into user_details (username, address, details, email, user_id) values ('name3','address_3','details_3','user.mail3@domain.org',null) select * from dual;
6 rows affected
 hidden batch(es)


select * from users;
EMAIL NAME ID
user.mail1@domain.org name_1 1
user.mail2@domain.org name_2 2
user.mail3@domain.org name_3 3
 hidden batch(es)


select * from user_details ;
USERNAME ADDRESS DETAILS EMAIL USER_ID
name1 address_1 details_1 user.mail1@domain.org
name2 address_2 details_2 user.mail2@domain.org
name3 address_3 details_3 user.mail3@domain.org
 hidden batch(es)


update ( select user_id, id from user_details UD join users U on UD.email = U.email ) set user_id = id ;
3 rows affected
 hidden batch(es)


select * from user_details;
USERNAME ADDRESS DETAILS EMAIL USER_ID
name1 address_1 details_1 user.mail1@domain.org 1
name2 address_2 details_2 user.mail2@domain.org 2
name3 address_3 details_3 user.mail3@domain.org 3
 hidden batch(es)