On 4/11/2013 1:07 PM, Thomas 'PointedEars' Lahn wrote:
> Jerry Stuckle wrote:
>
>> On 4/11/2013 11:23 AM, Thomas 'PointedEars' Lahn wrote:
>>> SpreadTooThin wrote:
>>>> ERROR 1064 (42000): You have an error in your SQL syntax; check the
>>>> manual that corresponds to your MySQL server version for the right
>>>> syntax to use near 'Group, 10, 16), conv(Element, 10, 16) from
>>>> StandardDicomDictionary' at line 1
>>>
>>> “GROUP” is a MySQL keyword (from “GROUP BY”); keywords are
>>> case-insensitive. In order to avoid a name being considered a keyword,
>>> quote it with backticks:
>>>
>>> SELECT `Description`, conv(`Group`, 10, 16), conv(`Element`, 10, 16)
>>> FROM `StandardDicomDictionary`;
>>>
>>> It is strongly recommended to quote *all* names, because which words are
>>> considered keywords depends on the MySQL version. So if you do not quote
>>> names, a MySQL upgrade or a version difference between test and
>>> production
>>> system could break your queries. You do not want that to happen.
>>
>> No, only YOU recommend making the SQL non-compliant with the standards
>> by using backticks.
>
> *SQL* compliance (however you want to define that) is not an issue in a
> *MySQL* query, see below. Besides:
>
Compliance with internationally accepted standards should ALWAYS be a
consideration by real programmers.
So what? Look at the SQL standards.
>> But then you think MySQL is the only database in the world, also.
>
> How did you get that weird idea? I have been developing for and with Access
> Jet SQL and MS SQL databases, *for example*. BTW, MySQL is a RDBMS with an
> SQL-based programming language, not a database.
>
From your insistence on violating internationally accepted standards
for SQL programming.
>> Real programmers always take into consideration standards compliance
>> when coding. You never know when your code will have to run on another
>> database, for instance. That doesn't mean everything is always
>> compliant - but is non-compliant code is the exception, not the rule.
>
> SQL compliance is not an issue here as MySQL versions extend revisions of
> the SQL standard, and you would never issue *raw* MySQL queries in a
> software program. Well, *real* programmers would not, and do not.
>
Compliance with standards should ALWAYS be a consideration. And
programmers DO issue SQL queries within a program. In my case I have a
hierarchy of classes in both C++ and PHP (predating PDO). My SQL is as
close to the standard as possible. As a result, I can, by just changing
one class, change databases with little or no problem. I have classes
set up for MySQL, PostgreSQL, Oracle and DB2 (I don't do SQL server).
You'd be surprised how much you can do by staying within the standards.