MySQL - Good Habits
In this article, we are going to learn few good habits that we can consider important aspect while work with MySQL to improve performance & troubleshoot as following below: #1 - Do not use stored procedure & function parameters name same as WHERE clause field name It will be responding with all record of query because MySQL interprets field value as parameter value similar like 1=1. Example: -- Bad CREATE PROCEDURE `getPersonById`( IN id INT (10)) BEGIN -- return all record instead SELECT id, name FROM person WHERE id = id; END -- Good CREATE PROCEDURE getPersonById( IN personId INT (10)) BEGIN SELECT id, name FROM person WHERE id = personId; END #2 - Use same data-type...