[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2528
  • Last Modified:

Oracle SQL Functions

What are the major differences  between,
LEAST - MIN
GREATEST - MAX
SQL functions.
Thanks
0
D-pk
Asked:
D-pk
  • 3
2 Solutions
 
sdstuberCommented:
MIN and MAX are aggregates/analytics,  they are used to find the smallest or largest value in a single column across multiple rows

input is one column/constant

LEAST/GREATEST compare multiple values within a single row
input is multiple columns/constants
0
 
sdstuberCommented:
also, you can use LEAST/GREATEST in pl/sql

v_my_number := LEAST(3,1,2);   --  should set variable to 1

v_my_other_number := GREATEST(2,3,1);  -- should set variable to 3

you can't do this with MIN/MAX because they are SQL functions only usable across a set of rows
0
 
D-pkAuthor Commented:
Thanks sdstuber
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now