SQLize Online / PHPize Online

A A A
Share   Donate   Blog   Popular
Copy Format Clear
create table test (id serial, email varchar(64), price int, type varchar(64), areaid int); insert into test (email, price, type, areaid) values ('person2@test1.com', 70, 'type1', 1), ('person3@test2.com', 60, 'type2', 2), ('person3@test3.com', 50, 'type1', 3), ('person4@test4.com', 110, 'type1', 3), ('person1@test1.com', 90, 'type2', 4), ('person2@test2.com', 65, 'type2', 1), ('person3@test3.com', 84, 'type2', 2), ('person4@test4.com', 84, 'type1', 2); DELIMITER $$ CREATE FUNCTION max_price() RETURNS int NOT DETERMINISTIC BEGIN DECLARE max_price int; SELECT MAX(price) INTO max_price FROM test; RETURN max_price; END $$ DELIMITER ; SELECT max_price();
Stuck with a problem? Need help? Ask professionals on our Telegram channel!
Join the channel
Your quersion is posted.
Join our Telegram channel and get answers.
Send
Copy