Hacker News new | ask | show | jobs
by ginko 1591 days ago
I've only had contact with DBs during my university years so please bear with me, but at least to me (mostly a systems programmer who played around with functional and logic programming languages) SQL seems, I dunno.. very crude? For instance it seems to me that PROLOG is a lot better at querying/defining relational facts.

Also every time I looked into SQL DBs I felt uncomfortable having to patch together SQL queries as strings and compile them at runtime. Why can't I define a DB schema in my compiled programming language and have it produce a typesafe query that can execute immediately? I know there's wrappers that help you define queries in a typesafe manner, but afaik these still generate query strings in the background.

2 comments

Few people, when they say "SQL is amazing!", mean the language.

The language is ok minus, it's usable and isn't a problem center. String parsing isn't expensive enough for anyone to replace, and there are many benefits to the 100% language decoupling it ensures.

What we mean is "RDBMSs are amazing!", and they are. Humanity has spent a lot of resources on their design and evolution, making them into systems that efficiently solve your hard problems years before you first find out you have them.

Yes, that's exactly what I meant.
Prolog isn't a DBMS, it's a functional / logic programming language. It doesn't store tables or operate on relational algebra.

How would you CRUD data DDL, DQL, DML, DCL, TCL against tables (not facts or variables) without SQL? Magic?

And why are you cobbling queries together manually and not using an ORM or library? SMH.