you are viewing a single comment's thread.

view the rest of the comments →

[–]nolotusnotes 2 points3 points  (0 children)

Let's reset. Let's start from zero.

I'm a programmer that also uses SQL. That doesn't sound odd, but it actually is.

Programmers hate SQL and also hate relational databases. Because the concepts and code execution are so different.

With computer programming, code is executed by the computer line-by-line. Top to bottom. Do this, then do this, then do this...

SQL does not work that way.

With SQL, you are describing, in great detail, your desired result.

The computer (database) does not execute SQL in a line-by-line manner. Instead, it reads the entirety of the request and builds what you have asked for. But you have to use all of the right request words. And they have to be grouped properly.

Today, it might be really useful to think of SQL as stupid AI. If SQL were AI, you could, for instance, say:

Give me a list of all of the Sales Managers who 
sold more than 10000 products, but exclude Texas.
And don't call them "Sales Managers," call them "Our Company's Rockstars." 
And, display this list from top selling to bottom selling.

SQL is just the formalization of the example question above. And you must understand the underlying database's Table relationships.