EX1_MYSQL_shalini_shambhuling.txt

EX1_MYSQL_shalini_shambhuling.txt - 1 Write a program that...

This preview shows pages 1–2. Sign up to view the full content.

1. Write a program that computes the perimeter and the area of a rectangle. Define your own values for the length and width. (Assuming that L and W are the length and width of the rectangle, Perimeter = 2*(L+W) and Area = L*W. Ans- delimiter // create procedure a_of_triangle() begin declare length float(5,2) default 5.09; declare width float(5,2) default 6.09; declare area float(5,2); declare perimeter float(5,2); set area= length*width; set perimeter=2*(length+width); insert into output values(area,perimeter); end;// delimiter; call a_of_triangle(); 2. Write a program that declares an integer variable called num, assigns a value to it, and computes and inserts into the tempp table the value of the variable itself, its square, and its cube. Ans- delimiter // create procedure sqr_cube(num int(4)) begin declare sqr int (6); declare cubee int(6); select pow(num,2), pow(num,3) into sqr,cubee;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern