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

select sqlite_version();
sqlite_version()
3.27.2
 hidden batch(es)


CREATE TABLE some_table ( id INT NOT NULL PRIMARY KEY, filler TEXT NOT NULL );
 hidden batch(es)


INSERT INTO some_table VALUES (1, '1_val'), (2, '2_val'), (3, '3_val'), (4, '4_val'), (5, '5_val'), (6, '6_val'), (7, '7_val'), (8, '8_val'), (9, '9_val'), (10, '10_val');
 hidden batch(es)


SELECT ROW_NUMBER() OVER () AS rn, * FROM (VALUES (5), (7), (1));
rn column1
1 5
2 7
3 1
 hidden batch(es)


SELECT st.id, st.filler, tab.rn, tab.column1, tab.column2 FROM some_table st JOIN ( SELECT ROW_NUMBER() OVER () AS rn, x.column1, x.column2 FROM (VALUES (1, 5), (2, 7), (3, 1)) AS x ) AS tab ON st.id = tab.column2 ORDER BY tab.column1;
id filler rn column1 column2
5 5_val 1 1 5
7 7_val 2 2 7
1 1_val 3 3 1
 hidden batch(es)


-- -- be nice to have FROM (VALUES (1, 5), (2, 7), (3, 1)) AS x (my_col_alia_1, my_col_alias_2) --
not an error
 hidden batch(es)