Sqlite: Finding the next or previous element in a table consisting of integer tuples
At the moment I try to find the next tuple with ("center" is (1-1-1-3))
Test
SELECT *
FROM tuples
WHERE (1,1,1,3) < (a,b,c,d)
ORDER BY a,b,c,d LIMIT 1
fiddle
You should store the 4 values concatenated and then converted to an int in a Generated Column. You can then index that column for better for performance and then your queries are just a comparison to one column which is simpler / more maintainable.
Your query to find the next Tuple would look like this:
select a,b,c,d from tuple
where 1113 < GeneratedColumn
order by GeneratedColumn
limit 1;