Похожие чаты

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 ответов

19 просмотров

Some SQL already store transaction logs internally

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

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

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

Всем привет! Имеется функция: function IsValidChar(ch: UTF8Char): Boolean; var i: Integer; ValidChars: AnsiString; begin ValidChars := 'abcdefghijklmnopqrstuvwxyzABCDE...
Евгений
44
For all those that keep asking why no pump? why this ? and why that...? Please close ur ewt chart and open 2 others - TOTAL (total mc) and BTC.D (btc dominance). Maybe BTC a...
Inn3r_G
19
"Since pnut can flip FTM easily, I'm swapping my FTM to pnut and hoping for a easy x5-x10" Perfect recipe for disaster. NFA but chances are, you'll end up as exit liquidity ...
C. A.
7
да кстати заметил всюда почему то всех сюда прёт, ни в одном чате столько ботов не прёт как сюда.. Может чота надо доработать?
REDis
15
AMD status update? No longer in the plan but something might be around the corner later on Chinese partner? No longer in the plan. This market does not seem to be the top ...
Ben
6
I get confused when people talk about the ‘bull market’ and the ‘next bull market’ as if anyone really has a clue what’s really going on in the world. First of all - there i...
Shah
1
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Всем привет, я тут короче оторвал кусок от рут-раздела и сделал свап, перезаписал fstab, загружаюсь и меня перекидывает в дебаг-шелл. Вижу ошибки бтрфс: Device total_bytes sho...
&[SirJiga] Jiga
9
Добрый день, подскажите, пожалуйста, по проблеме. Сегодня на работе утром обнаружилось что по рдп подключиться не получается к серверу 2022. В серверную зашел - на системно...
srv
19
И никого не интересует какие пакеты кто использует. ((% Заходишь на сайт симфони и видишь поддержку Украины - по законам РФ это ж экстремизм. Только никто не отказывается от с...
Am Ambrion
11
Карта сайта