Skip to content

Instantly share code, notes, and snippets.

View JayeshAgrawal's full-sized avatar
🏠
Working from home

Jayesh Agrawal JayeshAgrawal

🏠
Working from home
View GitHub Profile
@JayeshAgrawal
JayeshAgrawal / GoodHabitMySQL.sql
Last active January 19, 2021 16:24
Important aspect while work with MySQL to improve performance & troubleshoot
/****
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