MySQL Area


 

MySQL Area

This example illustrates how to find the area of rectangle in MySQL.

This example illustrates how to find the area of rectangle in MySQL.

MySQL Area 

This example illustrates how to find the area of rectangle in MySQL.

In this example we create a procedure to find the area of rectangle. In the query below we declare two integer type variable w and h with default value 5 and 4 respectively. By calling the procedure we can run the procedure which execute result.

 

Query

 

DELIMITER $$
CREATE PROCEDURE area1()
	BEGIN
	declare w INT DEFAULT 5;
	declare h INT DEFAULT 4;	 
	select @w * @h;	
	END$$
DELIMITER ;
call area1();

 

Output

 

@w * @h
-------
     20

 

Ads