News for hackers. Stuff that matters.
Re:We Can Do Better Than SQL by quickthrower2 on Tuesday August 11, 2020 @02:46AM (#24117773)
I was hoping for something more left field myself. If SQL is based on tables, what about a QL based on relations only. Columns of data that are related, the "TABLE" implementation detail doesn't need to factor into it.
Re:We Can Do Better Than SQL by cmrdporcupine on Tuesday August 11, 2020 @11:25AM (#24121286)
I think you might be misunderstanding what a relation is in the relational algebra or relational db. It's not a relationship. A relation is nothing more than a set of sets. Tables are relations, and views are relations. The results of queries are also relations.

This is a common misunderstanding of what the relational in "relational database" means. It's not (primarily) about relationships, except insofar that relationships can be described using relations and queried using relational algebra. But the key concept is that of the mathematical relation, as per Wikipedia:

"In mathematics, an n-ary relation on n sets, is any subset of Cartesian product of the n sets (i.e., a collection of n-tuples)"

So the goal of relational db languages is to provide tools for querying these sets of sets. Joins, Unions, Selections (Restrictions), and Projections are some of the tools that are provided. SQL provides some of these, though often calls them confusing names.

For example, in SQL the "select" keyword begins the query statement, but selection proper (as per relational algebra, also called restriction) is actually what is expressed in the "where" clause. What comes after "select" in your query is technically "projection" (choosing which tuples/columns exist in the output). Many ORMs and similar tools get this messed up, because the authors of them know SQL, but not the relational algebra on which it is nominally based.

Re:We Can Do Better Than SQL by jeltz on Tuesday August 11, 2020 @07:29AM (#24119222)
Isnvt that true for SQL? SQL treats everything as a relation and does not make any difference between a table, a view, a set returning function, a sub query or a CTE.
Re:We Can Do Better Than SQL by dragonwriter on Tuesday August 11, 2020 @02:52AM (#24117823)
> If SQL is based on tables, what about a QL based on relations only.

Aside from DDL (which I'm not sure how you would do without distinguishing between base relvars [tables], derived relvars [views], and other classes of relations), SQL doesn't particularly treat different kinds of relation differently beyond what is minimally necessary (you can't write, via insert or update, to a relation that isn't a relvar, for instance.)

Re:We Can Do Better Than SQL by iddan on Tuesday August 11, 2020 @03:58AM (#24118188)
This is what we are trying to do with Cayley https://github.com/cayleygraph/cayley
Re:We Can Do Better Than SQL by woile on Tuesday August 11, 2020 @04:38AM (#24118398)
The website needs a link to the documentation, I just couldn't find it :/
Re:We Can Do Better Than SQL by rplst8 on Tuesday August 11, 2020 @05:52AM (#24118749)
> If SQL is based on tables, what about a QL based on relations only.

Try Sparql.

Re:We Can Do Better Than SQL by udp on Tuesday August 11, 2020 @08:00AM (#24119407)
Came looking for the reference, and found it - but there are fewer and fewer mentions of SPARQL with each of these HN discussions. I think people just think "oh some semantic web crap" and move on without realising how powerful RDF etc. really can be when used as simple tools, without the 90s hype of changing the world with linked data.

At least the old ideas are resurging in the form of Neo4j (essentially a triplestore) and Cypher (essentially SPARQL).

Re:We Can Do Better Than SQL by tasubotadas on Tuesday August 11, 2020 @06:17AM (#24118860)
Re:We Can Do Better Than SQL by p4bl0 on Tuesday August 11, 2020 @04:58AM (#24118505)
Are you thinking of Datalog?