logoalt Hacker News

schaefertoday at 11:13 AM2 repliesview on HN

> …can't help but notice how sql is coming from the c-Era of programming. Having … more modern ways to express my queries would be great to improve correctness …

SQL is based in pure mathematics: set theory, relational algebra.

The process of applying mathematical rigor to your database design to prove correctness is referred to as normalization.

I don’t mind criticisms like “It’s old, yuck”, but criticisms like “it’s not correct” mean you haven’t studied or applied the mathematical underpinnings of sql.


Replies

dminiktoday at 11:40 AM

Syntax aside, programmers and mathematicians have a very different view on how things should be done.

Programmers look at data and see opportunities for running a pipeline of transformations (map/filter/...). And they tend to write their SQL like this as well. Or use something like Linq or one of the various pipe syntax SQL extensions.

I would say that this is a major reason why there is this sentiment of "SQL is yucky" by developers. The mental models just don't match.

show 1 reply
mkehrttoday at 11:33 AM

This isn’t talking about correctness of SQL. It’s talking about correctness of queries.