I'm new to PostgreSQL. I am currently working on a 3rd party PostgreSQL database, and I have limited READ permissions, so I'm unable to create a temp table, or create "user defined" variables. Moreover, I found that dealing with regular expressions is more difficult in Postgres than MySQL.
Question:
I have the following dummy table:
Code | Name
11199 | a
22299 | b
33399 | c
44499 | a
55599 | c
Now I have an offline list (can't create/modify tables in this DB) of numbers. I need to select the names whose code starts with these numbers - but the return code should be the code in the query statement.
Example list of numbers:
1
2
3
4
5
Desired query result:
code | name
1 | a
2 | b
3 | c
4 | a
5 | c
I could think of ways to accomplish it if I had more db permissions (such as inserting the list to a table in the database, plus using temp tables + if I could use regex like in mysql), but I don't know where to start on Postgres with this. Help? :)