Billy Verreynne wrote:
> Keith Lee wrote:
>
>
>>Does anyone know how to find the largest key in an Oracle database using
>>SQL commands? I could open use a PL/SQL procedure to loop through the
>>table until I get to the largest key; but, I was wondering if there was
>>any SQL command to do this.
>
>
> You're looking for the MAX() function.
>
> Something like:
> SELECT MAX(age) FROM employees
>
> ..which will give you the age of the oldest employee(s).
>
> I suggest that you spend some time with the Oracle SQL manual - SQL can do
> some pretty impressive stuff without needing to resort to PL/SQL or other
> languages.
>
> Remember that the secret of data processing in a database, is to let the
> database do all the work. SQL does exactly that. As soon as you use PL/SQL
> or any other language, _you_ do the processing with your code. Most of the
> time, this will be row-by-row processing. And several orders of magnitude
> slower than using SQL.
>
> So little grasshopper, the better you know SQL, the better your database
> kung fu. ;-)
>
>
> --
> Billy
I got the impression when I read his post that he wasn't looking for
something as simple as the highest (max) value, but the longest length
value.
Received on Wed Dec 04 2002 - 12:01:16 CST