3 ms·
I'm not an expert but whenever I need to use SQL it seems to be complicated enough as I need at the time to do the job. When the job becomes more complicated,
by gerdesj 4y ago
I'm not an expert but whenever I need to use SQL it seems to be complicated enough as I need at the time to do the job. When the job becomes more complicated, so does SQL.
I think it is a remarkably well designed language. I often get decent results for minimal effort. It isn't something I use day to day but more often month to month and I generally forget what I learned a couple of years ago.
For example, I wanted to clear down some records for a defunct client from our backup results database. I started by using SELECT to reliably find the customer (not as simple as it might sound). Then I construct an INNER JOIN (in this case most joins are the same) to link to the jobs. A SELECT COUNT(*) experiment looks about right. I snapshot the VM and change my experiment to a DELETE.
SQL is a bit strange but it lends itself to experimentation ... to results, way better than any other language I know.
Then you get into functions and views and the like. SQL has just enough complication for whatever job you have at hand and no more.
I recently ran up a query in Icinga2 (Director) against a MariaDB and it seemed to write itself. I get far fewer syntax errors in SQL than anything else that I try to abuse!