Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Function AVG
Functions SUM, MAX, MIN
30. MAX and MIN
Review

Instruction

Great. Okay, one final piece of information: you can also use DISTINCT with MIN or MAX to find the minimum or maximum value, respectively.

SELECT MAX(DISTINCT price)
FROM project;

What is the difference between MAX(price) and MAX(DISTINCT price)? Well, we hate to disappoint you, but there is none. :)

It's just an interesting fact about SQL that you can use DISTINCT with MIN or MAX but it won't change anything.

Exercise

Check it out for yourself. Show four columns:

  • the maximum number of words in a project (as max),
  • the maximum distinct number of words (as max_distinct),
  • the minimum number of words (as min),
  • and the minimum distinct number of words (as min_distinct).