karr4 Posted March 28, 2020 Share Posted March 28, 2020 When doing the min/max exercises , it will list the price. how would i find the product name? Link to comment Share on other sites More sharing options...
Sherin Posted April 7, 2020 Share Posted April 7, 2020 You want to try this create table product ( p_id int primary key, prod_name varchar(20), price varchar(5) ); insert into product values(1,"Milk",100); insert into product values(2,"Buttermilk",120); insert into product values(3,"Paneer",80); insert into product values(4,"Cheese",150); insert into product values(5,"Ghee",700); select * from product You can get the max price from table SELECT prod_name, MAX(price) FROM product GROUP BY prod_name; You can get min price from table SELECT prod_name, MIN(price) FROM product GROUP BY prod_name; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now