What Developers Need to Know about SQL – SQL is not for everything

Here is another intersting tweet from What Developers Need to Know About SQL Server:

What Aaron is talking about here is that SQL is a Query Language – that is what SQL and relational databases are optimized for – getting result sets.

SQL is not a data manipulation language – yes, you can do quite a lot of manipulation of string, dates and such, but the language does not lend itself to such operations.

It is far more efficient to move such operations to the client/UI code – whatever language you use to interact with the database will almost certainly have better facilities for manipulating strings and dates.

2 Responses

  1. Mostafa April 3, 2016 / 05:55

    So, could you tell us, what is these efficient ways? share us a link or give us more details. Thanks @odedcoster :)

  2. Oded Coster May 14, 2016 / 16:56

    There are too many scenarios to list – one example would be to parse out the specific portions from a varchar column (say you have some semi-structured data in it) – SQL (the standard) does not have efficient facilities do that (some databases have non-standard extensions that do).

    Fetching the whole field and looping over the results and parsing them out using regular expressions (for example) could be far more efficient.

Leave a Reply

Your email address will not be published. Required fields are marked *