Standard-Conforming Queries
We will try a simple query: SELECT COUNT(*) FROM book. We enter this query in the
query box as usual and send it. On the results page, we now see an additional link:
Validate SQL:
Chapter 12
[ 205 ]
Clicking on Validate SQL produces the following report:
We have the option of clicking Skip Validate SQL to see our original query.
Non Standard-Conforming Queries
Let's try this query, which works correctly in MySQL: SELECT * FROM book where
language = 'en'. Sending it to the Validator produces the following report:
Entering SQL Commands
[ 206 ]
Each time the Validator finds a problem, it adds a message like {error: 1} at the
point of error and a footnote in the report. This time, the language column name is
non-standard, so the Validator tells us that it was expecting an identifier at this point.
Another error is reported about the use of a LIMIT clause, which was added to the
query by phpMyAdmin and is also non-standard.
Another case is that of the backquotes. If we just click on Browse for the book
table, phpMyAdmin generates select * from `book`, enclosing the table name
with backquotes. This is the MySQL way of protecting identifiers, which might
contain special characters, like spaces or international characters, or reserved words.
However, sending this query to the Validator shows us that the backquotes do not
conform to standard SQL.
Pages:
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200