Solved

Oracle SQL Functions

Posted on 2010-08-25
4
2,496 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 73

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 73

Accepted Solution

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Function to return one result based on data in first query 11 45
TSQL - How to declare table name 26 31
convert null in sql server 12 34
T-SQL Default value in Select? 5 28
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

831 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