Hacker News new | past | comments | ask | show | jobs | submit login
Can we take a moment to appreciate the simplicity of Structured Query Language?
8 points by pyeri 6 months ago | hide | past | favorite | 5 comments
Now, I get that many programmers consider SQL to be too simple and noobish to be even considered a programming language. But of all languages, I think SQL stands out as not only one of the easiest to learn and practice, the sheer genius of this language is that it lets you do so much with so little expressiveness, while still trying to maintain standards across various kinds of databases as much as possible.

With all their expressive tokens and syntaxes, languages like C and Java and Python are often appreciated and rightly so, but I think SQL also deserves a place up there in the list of "do more with less jargon" things out there. In fact, the four basic DML/DDL statements (create, insert, update, delete) are all you need to get started with creating tables and manipulating data on most projects. And learning additional features like alter, drop, truncate, etc. is both fun and interesting.

And once you go even further with things like stored procedure and triggers, the real fun then begins! If you consider the below stored procedure of some hypothetical SQL dialect, it is no less elegant than any of the other popular expressive languages like Python or Ruby, don't you agree?

  create or replace procedure foo:
  begin
    select @test = select foo from bar;
    -- statement 2;
    -- statement 2;
    -- statement 3;
  end;



I remember doing a presentation about how SQL would remove the need for programmers to be involved in the process at all.


I’m a developer whose experience with SQL is limited to writing basic queries, window functions and combining those with CTEs.

All my business logic is written in a highly expressive language. It’s conveniently easy to read, change, and test.

And still, I’d like to learn how to implement complex business logic within the realm of my database so I can use it when appropriate.

What resources would you recommend for learning and practicing to write business logic in SQL, including good practices and testing?


The problem with SQL is not SQL itself, but how it integrates with modern programming languages. It’s the gap that it’s painful. My SELECT query is very elegant, but if it takes tons of custom code or even a library to transform the resulting rows in objects in the PL of choice, well then the elegance is worthless.


If the world could do normalisation...

I don't want to normalise the world. A new generation born, a new generation figuring out how to throw a ball, tie shoe laces, but not store data in a flat table.


since you like it so much, you should check other 4GL languages...SQL is not the only one

https://en.wikipedia.org/wiki/Fourth-generation_programming_...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: