3 ms·
>So an SQL UPDATE statement is purely declarative? "Update" sure looks like an operation to me The Update statement tells "set this column to this value". It's
by coldtea 8y ago
>So an SQL UPDATE statement is purely declarative? "Update" sure looks like an operation to me
The Update statement tells "set this column to this value". It's totally a declaration of intent.
It doesn't specify anything about how the update is going to happen behind the scenes (open this file, use this tree structure, traverse, find the nth entry, write this value to the disk, and so on).
(Databases also support PL/SQL which is more imperative in nature, but here we're talking about SQL the query language).
>but that doesn't mean it's not an operation, or can't be viewed as one. High-level operations are still operations.
Operation in the context of declarative vs non declarative is not about high vs low, it is about whether the language has the user explicitly define control flow.
In the "group by" the user just tells to the DB that they want the results grouped, they don't specify any control flow, or tell how that grouping will happen.
- pdonis 8y ago> The Update statement tells "set this column to this value". It's totally a declaration of intent. "Set this column to this value" sure looks like an operation to me. > It doesn't specify anything about how the update is going to happen behind the scenes Neither does the expression y = f(x). But that expression is the canonical example of a function, not a declarative statement. > Operation in the context of declarative vs non declarative Is whatever you are defining it to be, I get that. But I don't think the author of the article is using words the same way you are.