I am taking the free Stanford database course online. I don’t have any DB experience, but have many years of OS programming experience. Typically, I will flowchart or write out pseudo-code for a particular algorithm before coding it up. I was wondering if this technique can be used to go from a flowchart or pseudo-code into SQL statements.
Does a loop that iterates over a set match a WHERE clause? Is this mostly(?) or always(?) true?
How would you map a doubly nested loop into SQL?
SQL uses set-based logic (relational algebra/calculus), whereas most programming languages are imperative/procedural (e.g. C#, Java, etc).
If you write set-based logic pseudocode then it should be just as straightforward to translate to SQL as imperative pseudo-code is to translate to C#.
An example of set-based logic pseudo code might be something like this:
If you are trying to convert imperative pseudo-code to SQL (or set-based pseudo-code to C#) it’s going to be much more painful.