Solved

Oracle SQL Functions

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

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
Need a SQL query that creates a header row and one or more detail rows. 7 50
SQL Query assistance 16 36
AJAX pass along a variable 3 46
sql server query 12 23
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

789 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