Answers for "stored procedure mysql query"

SQL
2

MySQL Stored Procedures

DELIMITER $$

CREATE PROCEDURE GetCustomers()
BEGIN
	SELECT 
		customerName, 
		city, 
		state, 
		postalCode, 
		country
	FROM
		customers
	ORDER BY customerName;    
END $$

DELIMITER ;


-- Once you save the stored procedure, you can invoke it by using the CALL statement:

CALL GetCustomers();
Posted by: Guest on May-19-2021
0

MYSQL stored procedure select from

DELIMITER |
CREATE PROCEDURE getNearestCities(IN cityID INT)
    BEGIN
        DECLARE cityLat FLOAT;
        DECLARE cityLng FLOAT;
        SET cityLat = SELECT cities.lat FROM cities WHERE cities.id = cityID;
        SET cityLng = SELECT cities.lng FROM cities WHERE cities.id = cityID;
        SELECT *, HAVERSINE(cityLat,cityLng, cities.lat, cities.lng) AS dist FROM cities ORDER BY dist LIMIT 10;
    END |
Posted by: Guest on August-14-2021

Code answers related to "stored procedure mysql query"

Code answers related to "SQL"

Browse Popular Code Answers by Language