by chrysoprace · 3y ago · 0 comments
- It's backed by a mathematical theory (relational algebra).
- SQL has an international standard (although no implementation really follows this correctly if I'm not mistaken).
Lots of other languages have their own take on lists/arrays/dicts, but SQL is (generally) universal and often backwards compatible due to its extremely simple syntax.
I have a small hobby project (a frontend for a TV tuner device) that originally held channel and EPG data in a few python dicts.
This was clunky because I had to manually JSON-encode them and write them out, and saying "rewrite an entire 500kb config file when just 10 bytes had changed" always felt wrong. (Although, as I gather it, on an SSD, rewriting one byte may as well be the same as the whole file).
I replaced the guts with SQLite in part for that. I figured it's used enough for "we changed one row of 5,000" use cases that it would be optimized for that case. It also made cross-references simpler-- multiple table scans can be chained in a single statement, rather than having to nest queries and pass intermediary results from scan to scan. (For example, some program-guide data is more sensibly cross-referenced by physical channel number, and some by "display" channels, so being able to join in a table that maps the two streamlines stuff)