clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1130773 fiddles created (16556 in the last week).

CREATE TABLE tab AS SELECT 0 AS order_id, 'Aray' AS name UNION ALL SELECT 0,'Herbert' UNION ALL SELECT 0,'Paul' UNION ALL SELECT 0,'Peter' UNION ALL SELECT 0,'Tiffany'
 hidden batch(es)


SELECT * FROM tab;
order_id name
0 Aray
0 Herbert
0 Paul
0 Peter
0 Tiffany
 hidden batch(es)


UPDATE tab SET order_id = (SELECT rn FROM (SELECT name, ROW_NUMBER() OVER(ORDER BY name) AS rn FROM tab)s WHERE s.name = tab.name)
 hidden batch(es)


SELECT * FROM tab;
order_id name
1 Aray
2 Herbert
3 Paul
4 Peter
5 Tiffany
 hidden batch(es)