is it possible to somehow get elements from the postgresql array by index? I did not find anything sensible on the Internet on this issue. I have a table:
CREATE TABLE groups_timetable(id SMALLINT PRIMARY KEY, timetable VARCHAR(40)[]);
INSERT INTO groups_timetable(id, timetable) VALUES(1, '{"math, physical culture, programming", "math, economic theory"}');
CodePudding user response:
You can just get element by using index -
select timetable[1] from groups_timetable --where 1 is index
Note - The arrays are 1 indexed.