Похожие чаты

I'M looking for a database that would suit my needs. I

want to log some data, in order to see change over time.
In order to conserve space, I'd store revisions, containing only changed properties, rather than the full object each time.

This would cause my tables to look somewhat like this, with content:

+-----+-----+-----+-----+-----+
| _id | name| a | b | c |
+-----+-----+-----+-----+-----+
| 1 | x | 1 | 11 | 111 |
| 2 | x | 2 | | |
| 3 | x | | 33 | |
+-----+-----+-----+-----+-----+

_id is an a unique id for that row.
name is a common identifier for the revisions,
a, b and c are data properties.

For now, this is all fine, but it starts to get complicated when I want to query this.
I'd have to write a query that would get the newest info where name is x.
This should produce:

+-----+-----+-----+-----+
| name| a | b | c |
+-----+-----+-----+-----+
| x | 2 | 33 | 111 |
+-----+-----+-----+-----+

I don't even know if that is possible, and if it is, its probably very inefficient.

Anyone got any good idea on how to tackle this?

2 ответов

12 просмотров

Some SQL already store transaction logs internally

Initial table should be: _id | name | field ("a","b","c") | value

Похожие вопросы

Обсуждают сегодня

Вопрос по диагностике ошибок (я знаю в чем, в данном конкретном примере, я знаю, как исправить, пример модельный, понятно, что в реальности бывает намного запутаннее). module...
ⰄⰎⰋⰐⰐⰑⰛⰤⰧⰧⰩⰄ ⰊⰑⰁⰓⰡⰛⰦⰕⰫ
10
Asus, норм фирма для ноутов?
Артем Записной
20
И ещё - определить, имеет ли он доступ к интернету очень просто - смотрим всех пользователей сети. И да, как оно без сети передаст данные в куда то?
BytePixel 🐧
15
А чем вам питонисты не угодили?😂
.
79
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
48
Hey everyone! How can I pass string from Rust to c++ function that expects std::string? When I'm passing CString the c++ functions tell that the string is empty
Jacob
16
Ясн. Но я всеравно к кедам отношусь с опасением. Чисто субьективное кедосозерцание. Что касаемо "восторга изяшности кед" так и не вкурил, хотя много слышал, пока не поставил с...
Артем Записной
30
Hey guys, did you see the new announcement about $Fun? 🔥
Filip Murphy
55
Есть предложения, как подобное можно упростить?
Hemul GM
12
type TObj = object procedure Init; virtual; end; TObj1 = object(TObj) procedure Init; override; end; procedure TObj1.Init; begin inherited; end; procedur...
Alexander 👋
29
Карта сайта