News for hackers. Stuff that matters.
Re:PRQL a simple, powerful, pipelined SQL replacement by adamzochowski on Friday December 30, 2022 @07:56AM (#34184572)
> SQL has many problems: > "from" should come first to help auto-complete;

Agreed

> null handling is complicated;

Mostly the issue is that null in dbs has different semantics than all programming languages. I wish programming languages used the db style of handling nulls. In dbs, null means that the value is unknown and can't be reasoned about. DB uses nulls in how people reason arguments: "Joe's age is unknown, Jane is 25 years old. Are they of same age? We can't say if their age are equal, or unequal, because we don't know."

> the syntax in general is weird.

I find syntax to be like any time switching a language. Python is weird to C++. Atleast with SQL, I find usage docs more understandable than many programming languages.

> Compatibility is a problem

This sounds like a complaint that two different programming languages are not providing same features. Or two operating systems have different UI toolkits (and different menu conventions, like where should the 'preferences' be under).

I wouldn't expect sqlite to be Oracle / MSSQL / PGSQL compatible.

Re:PRQL a simple, powerful, pipelined SQL replacement by onlyrealcuzzo on Friday December 30, 2022 @08:16AM (#34184711)
> In dbs, null means that the value is unknown and can't be reasoned about.

Except it can also mean it's `null` in that the field is optional and the record doesn't have it.

Re:PRQL a simple, powerful, pipelined SQL replacement by adamzochowski on Friday December 30, 2022 @10:10AM (#34185699)
An optional value just means that the value is unknown.

For example, it is optional to enter the colour of the car I own. So my car colour is null. The database can't confirm if my car is Red or isn't Red, because it is an unknown value.

Re:PRQL a simple, powerful, pipelined SQL replacement by tremon on Friday December 30, 2022 @02:26PM (#34188912)
Not really. A null value in a certain column does not indicate that the field is optional; instead, the table definition having a nullable column indicates that the field is optional. A null value in a nullable column indicates only that the value is unknown, nothing else. This is database modeling 101:

A table ("relation") describes one entity. The attributes of the entity are reflected in the table column set, and each table row represents a different instance of said entity. Marking a column as nullable means that not knowing that attribute is a recoverable situation (for example, because it is only stored for informational purposes and not for processing).

If you're using the same table to store multiple entities, using nullable columns to indicate if a row represents entity A or entity B, you're doing it wrong.