By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table a (ID int, Name varchar(20))
insert into a values (5, 'Me')
create table b (ID int, Class varchar(20))
Insert into b values (13, 'Math')
Create table c (aID int, bID int)
INSERT INTO c VALUES (
(SELECT ID from a where Name='Me'),
(SELECT ID from b where Class ='Math')
)
SELECT * FROM c
aID | bID |
---|---|
5 | 13 |