create database Practice; use Practice ; create table Customers( id int not null, NAME varchar(20) NOT NULL, aGE INT NOT NULL, Address varchar(20), Salary decimal(10,2), primary key (ID) ); insert into Customers values(1,'Abi',32,'Banglore',50000.00); insert into Customers values(2,'Bharath',22,'UP',60000.00); insert into Customers values(3,'Charan',42,'Andra',70000.00); insert into Customers values(4,'Deepa',52,'Kolkatha',20000.00); insert into Customers values(5,'Esha',27,'Maharastra',30000.00); insert into Customers values(6,'Ganesh',72,'Delhi',35000.00); insert into Customers values(7,'Inchara',22,'Banglore',54000.00); insert into Customers values(8,'Jaya',31,'UP',60000.00); insert into Customers values(9,'Harish',35,'Andra',55000.00); insert into Customers values(10,'Thanesh',35,'Andra',66000.00); select * from Customers; DELIMITER // create procedure getAllCustomers() begin select * from Customers; end // DELIMITER ; call getAllCustomers(); DELIMITER // create procedure orderedSalary() begin select * from Customers order by salary ; end // DELIMITER ; DELIMITER // create procedure greaterthensalary() begin select * from Customers where salary > 55000 ; end // DELIMITER ; DELIMITER // create procedure greaterthensalarydynimic(IN mysalary int) begin select * from Customers where Salary > mysalary; End // DELIMITER DELIMITER // create procedure getCount1(OUT totalcount int) begin Select count(age) into totalcount from Customers where age > 40; END // DELIMITER call getCount1(@totalcount); // 3 select @totalcount; call getAllCustomers(); call orderedSalary(); call greaterthensalary(); call greaterthensalarydynimic(61000); call getCount1(@totalcount);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter