← Back to context

Comment by bob1029

8 hours ago

> 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

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?) :/

> 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!

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.

> 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.

  • SQL is not an imperative programming language.

    • DROP TABLE ?

      Most of SQL is not imperative, but it certainly also includes some imperative commands.

      Inserting a new row into an existing table is an imperative command, which may be the most frequently used of the SQL features, in certain applications concerned with recording transactions.

      Only the subset of SQL that is used for queries can be said to not be an imperative programming language.

      7 replies →