SQL syntax debug

From LemonWiki共筆
Jump to: navigation, search

How to debug MySQL query syntax

Approach 1: Reduce the complexity of Sql query[edit]


  • Reduce the complexity of SQL syntax ex: reduce the WHERE condition
  • Examine the sub query part only
  • Enable the MySQL server log contains each query or errors. Details on Testing#Database_server
  • Disable unnecessary database operation permission

Approach 2: Using MySQL syntax checker[edit]

Approach 3: Beautify the Sql syntax[edit]

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[edit]

MySQL server configuration

Further reading