是否可以通過索引以某種方式從 postgresql 陣列中獲取元素?關于這個問題,我在互聯網上沒有找到任何合理的資訊。我有一張桌子:
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"}');
uj5u.com熱心網友回復:
您可以通過使用索引來獲取元素 -
select timetable[1] from groups_timetable --where 1 is index
注 - 陣列是 1 索引的。
DB小提琴
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/318867.html
標籤:PostgreSQL
