SQL syntax debug: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 17: Line 17:


Further reading
Further reading
* [http://www.craigkerstiens.com/2016/01/08/writing-better-sql/ Writing more legible SQL Craig Kerstiens] {{access | date = 2016-11-03}}
* Craig Kerstiens (2016). [http://www.craigkerstiens.com/2016/01/08/writing-better-sql/ Writing more legible SQL] {{access | date = 2016-11-03}}


[[Category:Programming]] [[Category:MySQL]] [[Category:Data Science]]
[[Category:Programming]] [[Category:MySQL]] [[Category:Data Science]]

Revision as of 16:27, 3 November 2016

How to debug MySQL query syntax

Goal:

  • Reduce the complexity

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
  • Beautify the sql syntax e.g.
    • 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

MySQL server configuration

Further reading