How can I check the SQL syntax in a .sql file?

后端 未结 7 1228
走了就别回头了
走了就别回头了 2021-02-03 23:20

How can I check the SQL syntax in a .sql file?

相关标签:
7条回答
  • 2021-02-04 00:03

    There are a couple of possiblities. If you are using InnoDB tables that support transactions, you can simply execute a start transaction; at the beginning of your .sql file and a rollback; at the end. MySQL will output any syntax errors.

    If you are testiing UPDATE or DELETE statements, you could add LIMIT 0 to the end to prevent these queries from making any database changes, and still have MySQL check the syntax.

    0 讨论(0)
提交回复
热议问题