SQL .
SQL Min
SQL Min() Example One - Characters
Q: What Helen Hunt movie has the first title alphabetically?
Select Min(Film_Title)
From Thespian_Film_Table
Where Thespian_Last_Name equals "Hunt"
and Thespian_First_Name equals "Helen";
As Good As It Gets
Max and Min can be used to find the row with the greatest or smallest value characters. Max and Min can also find the row with the largest or smallest numerical value.
SQL Min() Example Two - Numerics
Q: What was the earlier movie Helen Hunt made, Twister or As Good As It Gets?
Select Min(Film_Year)
From Film_Table
Where Film_Title in ("Twister", "As Good As It Gets");
1996
Bonus SQL Min() Example Three - Numerics With A Subselect
Q: 1996? That doesn't answer my question. I asked "What was the earlier movie Helen Hunt made, Twister or As Good As It Gets?"
Select Film_Title, Film_Year
From Film_Table
Where Film_Title in ("Twister", "As Good As It Gets"
and Film_Year in
(Select Min(Film_Year)
From Film_Table
Where Film_Title in ("Twister",
"As Good As It Gets"));
Twister
| Comments |
| Sign in to be the first to comment on SQL Min. |