Jump to content
Sign in to follow this  
M Vishnu vardhan

MIN() and MAX()

Recommended Posts

Hello, @M Vishnu vardhan

MIN() function :

  • The MIN() function returns the smallest value in the specified table field(column).
  • For example, let's suppose we want to know the year in which the oldest movie in our library was released, we can use MySQL's MIN() function to get the desired information.
SELECT MIN(`year_released`) FROM `movies`;

Execute above query in MySQL the output look like that :

MIN('year_released')

2005

MAX() function :

  • The MAX() function is the opposite of the MIN() function. It returns the largest value from the specified table field(column).
  • Let's assume we want to get the year that the latest movie in our database was released. We can easily use the MAX() function to achieve that.
SELECT MAX(`year_released`)  FROM `movies`;

Execute above query in MySQL the return output look like that :

MAX('year_released')

2019

I hope above information will be useful for you.
Thank you.
 

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...