Jump to content

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 :



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 :



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

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.

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.

  • Create New...