Jump to content
Sign in to follow this  
karr4

MIN MAX

Recommended Posts

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;

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...