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

CREATE TABLE test (value VARCHAR(255)); INSERT INTO test VALUES ('8-10'), ('3-9'), ('5'), ('4-6'); SELECT * FROM test;
value
8-10
3-9
5
4-6
 hidden batch(es)


-- MySQL SELECT * from test where 5 > substring_index(value,'-',1) and 5 <substring_index(value,'-',-1) or value=5;
value
3-9
5
4-6
no such function: substring_index
 hidden batch(es)


SELECT *, substring_index(value,'-',1) from test
value substring_index(value,'-',1)
8-10 8
3-9 3
5 5
4-6 4
no such function: substring_index
 hidden batch(es)


-- SQLite SELECT * from test where 5>substr(value, '-', length(-value)) and substr(value, length(-value)+1)<5 or value = 5;
value
5
value
 hidden batch(es)


SELECT *, -value, length(-value), substr(value, '-', length(-value)), substr(value, length(-value)+1) from test
value -value length(-value) substr(value, '-', length(-value)) substr(value, length(-value)+1)
8-10 -8 2 10
3-9 -3 2 9
5 -5 2
4-6 -4 2 6
value -value length(-value) substr(value, '-', length(-value)) substr(value, length(-value)+1)
 hidden batch(es)