I tried searching for this for a long time, but all answers don't really get me anywhere.
I'm trying to write a SQL query where I need to map certain values to new groups with wildcards, in between certain boundaries This would look something like this:
SELECT number,
CASE
WHEN number >= LIKE '0' AND number <= LIKE '009%' THEN 'group 1'
WHEN number >= LIKE '010%' AND number <= LIKE '027%' THEN 'group 2'
ELSE '0'
END AS NEW_GROUPS
This is necessary because numbers can be like 00923 and 00811 and they will need to be in the first category. As 010.123, 010123 and 0270 need to be in the second.
If something like this isn't really possible, then it is also an option to use the map method in Python with a dictionary (something like:
df['number'].map({..})
But I am not sure how to use the lambda/regex/wildcard here. Help is greatly appreciated!