This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER | | |
CREATE TRIGGER cancel_delete BEFORE DELETE ON table | |
FOR EACH ROW | |
BEGIN | |
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'DELETE canceled'; | |
END | | |
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, nombre, (6371 * ACOS( | |
SIN(RADIANS(lat)) * SIN(RADIANS(4.6665578)) | |
+ COS(RADIANS(lng - -74.0524521)) * COS(RADIANS(lat)) | |
* COS(RADIANS(4.6665578)) | |
) | |
) AS distance | |
FROM direcciones | |
HAVING distance < 1 /* 1 KM a la redonda */ | |
ORDER BY distance ASC |