How to write insert/update/delete/select postgresl Text array?
Assume I have a table as following:
CREATE TABLE classes (
students TEXT[] not null DEFAULT '{}'
);
Will this is a correct syntax for insertion using servlet?
...
String student_names = "{a, b, c, d}";
String sql = "INSERT INTO classes (students) VALUES(?)";
preparedStatement = conn.executeQuery(sql);
preparedStatement.setString(1, student_names);
...
Then how can I select or update the index in the array? I read the doc not really know how to write the query for it. I tried to search on google but couldn't find a good resource about it neither.