Solved

Oracle SQL Functions

Posted on 2010-08-25
4
2,504 Views
Last Modified: 2013-12-19
What are the major differences  between,
LEAST - MIN
GREATEST - MAX
SQL functions.
Thanks
0
Comment
Question by:D-pk
  • 3
4 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 33523775
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
 
LVL 74

Accepted Solution

by:
sdstuber earned 125 total points
ID: 33523796
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 125 total points
ID: 33523826
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
 

Author Closing Comment

by:D-pk
ID: 33525504
Thanks sdstuber
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question