Solved

Oracle SQL Functions

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now