4 ms·
> It’s interesting how much SQL, a declarative language, I think this is the main mistake. SQL is not declarative language, is a high-level DSL: 1 + 1 = 2
by mamcx 5y ago
> It’s interesting how much SQL, a declarative language,
I think this is the main mistake. SQL is not declarative language, is a high-level DSL:
1 + 1 = 2 //most PLs
SELECT 1 + 1 = 2 //SQL
SET 1 + 1 = 2 //TCLish
[1, 2] | sum = 2 //Functional
<span>1</span><span>+</span><span>1</span> = NOT 2! //HTML, a TRUE declarative language!
The main issues that causes this is that SQL is most of the time a little piece disconnected here and there. You don't see how is so imperative and functional until you write manually a big .sql file.
Also, is crippled intentionally, so you don't use it for "regular" programming task (ie, not real way to do print("hello world")!.
I start with FoxPro/dBASE and never develop this disconnect because for me, in Fox, SQL was just another sub-dialect of Fox, that was a "full" programming language. So every-time I do:
SELECT * FROM customer WHERE code = 1
SCAN customer WHILE code = 1 //Equivalent Fox CMD
?customer
ENDSCAN
And similar how in Fox you know that your filters and sort depend on indexes then the same with SQL.
I still look SQL and see it imperatively and have a good grasp on how everything execute (ie: at least until the query planner disagree with me!).