How to only pick the first matched row in a one-to-many relationship? I have two tables A and B with one-to-many relationship.

For rows A1 and A2 in table A, the relationship is

A1 -&gt; [B11, B12, B13]
A2 -&gt; [B21, B22]


When I join A and B I get

A1,B11
A1,B12
A1,B13
A2,B21
A2,B22


Instead I want

A1,B11
A2,B21


What should I do? I don't know what this mapping is called.
Use analytics - see documentation or examples here eg

Tables

create table A ( c1 ) as
select 'A1' from dual union
select 'A2' from dual ;

create table B ( c1, c2 ) as
select 'A1', 'B11' from dual union
select 'A1', 'B12' from dual union
select 'A1', 'B13' from dual union
select 'A2', 'B21' from dual union
select 'A2', 'B22' from dual ;


When joining the tables, we get ...

SQL&gt; select *
  2  from A join B on A.c1 = B.c1 ;

C1 C1 C2 
-- -- ---
A1 A1 B11
A1 A1 B12
A1 A1 B13
A2 A2 B21
A2 A2 B22


Use FIRST_VALUE (without joining the tables)

select unique
  c1
, first_value( c2 ) over ( partition by c1 order by c2 ) fv
from B ;

C1 FV 
-- ---
A1 B11
A2 B21