CREATE TABLE t (
id SERIAL PRIMARY KEY,
year int not null,
updated_at timestamp not null,
value int not null
);
INSERT INTO t(year, updated_at, value) VALUES (2022, '2022-01-01 23:11:11', 17);
INSERT INTO t(year, updated_at, value) VALUES (2022, '2024-01-01 20:11:11', 13);
INSERT INTO t(year, updated_at, value) VALUES (2023, '2024-06-02 20:11:11', 0);
INSERT INTO t(year, updated_at, value) VALUES (2023, '2024-06-02 20:11:13', 101);
INSERT INTO t(year, updated_at, value) VALUES (2023, '2024-06-02 20:11:17', 55);
INSERT INTO t(year, updated_at, value) VALUES (2024, '2024-03-02 20:11:11', 117);
INSERT INTO t(year, updated_at, value) VALUES (2024, '2024-03-02 20:11:22', 5);
SELECT t1.*,
( SELECT value
FROM t t2
WHERE t1.year - 1 = t2.year
ORDER BY updated_at DESC LIMIT 1
) AS prev_value
FROM t t1;
With JDBC, a database is represented by a URL (Uniform Resource Locator). With PostgreSQL®, this takes one of the following forms: jdbc:postgresql:database jdbc:postgresql:/ jdbc:postgresql://host/database jdbc:postgresql://host/ jdbc:postgresql://host:port/database jdbc:postgresql://host:port/
postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]
Я всего лишь напомнил, что в исходном виде (без уточнений) вопрос не имеет смысла.