logoalt Hacker News

bob1029today at 8:34 AM5 repliesview on HN

> CQL is not a database management system: it neither stores nor updates data.

The same could be said for SQL. How does CQL differ from SQL? If I squint my eyes just a tiny amount, these ideas become really difficult to separate. I was always under the impression that the relational model is based upon many concepts studied in category theory. To my mind, all of the following things are overlapping parts of the exact same monster:

  Set theory
  Category theory
  Graph theory
  Type theory
  Discrete mathematics 
  Relational algebra
  Relational calculus
  Relational modeling
  An actual sql schema

Replies

mamcxtoday at 2:33 PM

> How does CQL differ from SQL?

Most attempts to replace/improve SQL derive from the fact SQL was a poorly conceived and designed interface, that originally was meant to be a very small DSL for end users, but unfortunately, was allowed to become a poor, complicated, confusing mess for app developers:

https://cacm.acm.org/research/50-years-of-queries/

    SQL is not an orthogonal language... This is because, in the early days, Ray Boyce and I did not think we were designing a language for programmers. ..
 As it turned out, Ray and I were wrong about the predominant usage of SQL...
(same problem from JS, php, etc: Creators don't anticipate that developers will suffer and torture their needs with such anemic ideas!)

---

So the #1 thing any actual replacement or alternative to SQL is how actually become a good language for development, so it is actually composable, can be actually be used to reason about it, has minimal foot guns, etc.

There is a lot of misunderstanding and pushback, similar to how people in the past fight improvements over JS/C/C++ until typescript, rust comes.

But, oh boy, SQL need their typescript!

jeltztoday at 12:04 PM

The main innovation here seems to be compile time checking of that foreign keys are respected but that is a thing that can be added to SQL and there is at least one proposal for doing so. So I do not really see anything fundamentally different from SQL.

https://keyjoin.org/

Full disclosure: I am one of the co-authors of this paper and an associated patch implenting it in PostgreSQL that we have proposed.

I am happy to see more people than us think this is useful.

show 1 reply
Groxxtoday at 3:52 PM

Since it took bit of time and multiple broken links to find: https://categoricaldata.net/examples has links to a lot of info about CQL for learning/comparing/etc.

(edit: in retrospect, this is just the "getting started" header link, despite the URL)

Unfortunately none that I've followed seems to do much to describe much of anything except the math foundations. They might cover pieces of syntax, but not how to use or think about them, and they seem to be rather excited about the data-generating features that I can't imagine anyone using outside tech demos (unless that's the only insert method? what about update?) :/

(edit 2: you can't even rely on the manual apparently, I'm fairly confident https://categoricaldata.net/help/Demo.html (manual -> examples -> demo) won't work because it has no schema definition for `Animal`. and it like all the others I've checked are little more than syntax and output, no real explanation)

js8today at 8:45 AM

> How does CQL differ from SQL?

SQL is like Java, CQL is like Haskell. SQL has been around and used in production. CQL is a research language, possibly cleaner foundation but YMMV.

The math fields you list are connected, but whether they are the same monster - again it's kinda like claiming all programming languages and implementations are the same (Turing-complete?) monster.

show 1 reply
khanatoday at 1:34 PM

[dead]