SQL syntax debug: Difference between revisions
Jump to navigation
Jump to search
| Line 11: | Line 11: | ||
== Approach 2: Using MySQL syntax checker == | == Approach 2: Using MySQL syntax checker == | ||
* [https://www.mysql.com/products/workbench/ MySQL :: MySQL Workbench] (blog: [http://mysqlworkbench.org/ The MySQL Workbench Developer Central Site]): Syntax checker for MySQL statements. Required to install the software. | * [https://www.mysql.com/products/workbench/ MySQL :: MySQL Workbench] (blog: [http://mysqlworkbench.org/ The MySQL Workbench Developer Central Site]): Syntax checker for MySQL statements. Required to install the software. | ||
* [http://developer.mimer.se/validator/index.htm Mimer SQL Developers - Mimer SQL Validator] Syntax checker for SQL-2003 and so on. {{Gd}} Not required to install the software, checking result was able to be viewed using the browser. | * [http://developer.mimer.se/validator/index.htm Mimer SQL Developers - Mimer SQL Validator] Syntax checker for SQL-2003 standard and so on. {{Gd}} Not required to install the software, checking result was able to be viewed using the browser. | ||
* [http://cweiske.de/php-sqllint.htm cweiske.de: tools: PHP-SQLlint]: Required to install the software. | * [http://cweiske.de/php-sqllint.htm cweiske.de: tools: PHP-SQLlint]: Required to install the software. | ||
* More on [https://www.quora.com/Where-can-I-find-a-good-MySQL-syntax-checker Where can I find a good MySQL syntax checker? - Quora] | * More on [https://www.quora.com/Where-can-I-find-a-good-MySQL-syntax-checker Where can I find a good MySQL syntax checker? - Quora] | ||
Revision as of 14:08, 31 August 2017
How to debug MySQL query syntax
Approach 1: Reduce the complexity of Sql query
Steps:
- Reduce the complexity of SQL syntax ex: reduce the WHERE condition
- Examine the sub query part only
- Enable the MySQL server log. Details on Testing#Database_server
- Disable unnecessary database operation permission
Approach 2: Using MySQL syntax checker
- MySQL :: MySQL Workbench (blog: The MySQL Workbench Developer Central Site): Syntax checker for MySQL statements. Required to install the software.
- Mimer SQL Developers - Mimer SQL Validator Syntax checker for SQL-2003 standard and so on.
Not required to install the software, checking result was able to be viewed using the browser. - cweiske.de: tools: PHP-SQLlint: Required to install the software.
- More on Where can I find a good MySQL syntax checker? - Quora
Approach 3: Beautify the Sql syntax
Beautify the SQL syntax for better readability.
- Using the text editor Sublime, and enable the Menu option: View > Syntax >SQL. The syntax will become colorful for easy to read!
- Instant SQL Formatter
Related articles
MySQL server configuration
Further reading
- Craig Kerstiens (2016). Writing more legible SQL [Last visited: 2016-11-03]