I'm wondering how to search a database table using a given variable or an array in the SQL query. I'm currently using Java and PostgreSQL and I want to do something like:
String word = "Apples";
SELECT * FROM table WHERE name = word;
or
token[0] = "Apples";
SELECT * FROM table WHERE name = token[0};
Does anyone know the correct way to do this?
My eventual goal is simply to check the database to see if a word that a user has input is stored in the database and if it is then do something with that word.