|
|
|
|
|
by gregjor
641 days ago
|
|
SQL is a declarative language for working with relational databases. The concept of composability doesn’t apply. SQL does support code reuse and building layers of abstractions. If you only use SQL through an ORM you won’t get to use things like CTEs and views and user-defined functions, because ORMs by definition deform the relational model and SQL to fit OOP. In 40+ years programming SQL expertise has paid the bills and kept me employed more reliably than any other language or tool I have mastered. |
|
No. First and foremost, SQL is for tablational databases. A relation and a table are similar, to be fair, but have some key differences:
- A relation is an unordered set of tuples. SQL opts for an ordered list of tuples (a table) instead.
- A relation has no concept of NULL. A table does.
- The implications of those differences also bring a whole bunch of other differences that further divide SQL from the relational model.
SQL's only association to relational databases is in its name, being originally SEQUEL which was a play on QUEL – a language actually for relational databases that was a direct adaptation of Alpha from Codd's original paper.
> The concept of composability doesn’t apply.
Of course it does. Why wouldn't it apply? Datalog, a declarative language for querying data, is in many ways similar to SQL and it supports composition just fine. Many of the compile-to-SQL languages also support composition just fine. SQL could be composable. It should be composable. It just, because it still desperately clings to its COBOL-era glory days, is too afraid to add support.
> In 40+ years programming SQL
40+ years of working with SQL and you are still this confused about it...?