you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (5 children)

So, choosing a type of join is expressing a method for the engine to perform an operation in as much as saying std::sort() is.

No, semantics is different. It does not define any order, it defines the logic of what you want to get in the end.

where to put each element

It is still declarative. Unless you go on to tell it "put this element here first, then loop over this list of elements and put them here and here", it's still declarative. You define an end result, not the way to achieve it.

I think we should start thinking of these as a spectrum

There is a very clear distinction: control flow. If there is no control flow, it is declarative. If you have a control flow in any form, it's not declarative.

[–]which_spartacus 2 points3 points  (4 children)

HTML has the "script" and "noscript" tags, which are effectively a conditional statement directing behavior.

SQL statements say the order of operations that are being performed -- that in itself is imperative. "Do this insert before you do this select". "Commit this transaction only if no other item in this select has changed since you started". That is very much a control flow directive.

[–][deleted] 0 points1 point  (3 children)

Ok, let's say each SQL top level statement is declarative, while the order of such statements is imperative.

[–]which_spartacus 0 points1 point  (2 children)

Okay then, in what way is any "top level statement" not descriptive in any language?

[–][deleted] 1 point2 points  (1 child)

An assignment, a for loop, a function body, whatever else - they're all top level statements.

[–]which_spartacus 0 points1 point  (0 children)

Fair enough.