Share on Google+Share on Google+

MySQL Area

Advertisement
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

 

Advertisements

Posted on: December 9, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.