By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 5
| id | firstname | lastname | rn | id | firstname | lastname |
|---|---|---|---|---|---|---|
| 4 | alexandre | Graham Bell | 1 | 4 | alexandre | curie |
| 2 | isaac | newton | 2 | 2 | null | einsten |
| 3 | null | curie | 3 | 3 | isaac | Graham Bell |
| 1 | albert | einsten | 4 | 1 | albert | Edison |
| 5 | thomas | Edison | 5 | 5 | thomas | newton |
SELECT 5
| id | firstname | lastname |
|---|---|---|
| 3 | alexandre | curie |
| 5 | null | einsten |
| 1 | isaac | Edison |
| 2 | thomas | Graham Bell |
| 4 | albert | newton |
UPDATE 5
| id | firstname | lastname |
|---|---|---|
| 4 | isaac | newton |
| 3 | thomas | curie |
| 1 | alexandre | Edison |
| 2 | albert | Graham Bell |
UPDATE 4
| id | firstname | lastname |
|---|---|---|
| 5 | null | einsten |
| 4 | isaac | newton |
| 3 | thomas | curie |
| 1 | alexandre | Edison |
| 2 | albert | Graham Bell |
SELECT 5