You are here: Aggregate/Scalar or via code? « All PHP « IT news, forums, messages
Aggregate/Scalar or via code?

Posted by -Lost on 08/21/06 08:05

I hope that is not too vague of a question.

I have begun taking a database class in school, which is where this question spawned from.

If I were to use the aggregate or scalar functions for example, are they preferred over
using code (such as PHP, VB/ASP et cetera)?

An example of this is:

SELECT AVG(column_name) FROM table_name

....whereas with PHP it would be:

// retrieve the entire column via a query, then

function average($_array_of_average_inputs)
{
return array_sum($_array_of_average_inputs) / count($_array_of_average_inputs);
}

$avg = average($average_array);

....and on and on. Or something like:

SELECT UCASE(column_name) FROM table_name

....whereas with PHP it would be:

// retrieve the entire column via a query, then

$final_result = strtoupper($ascii_results_of_query);

So, sorry if I rambled on a bit. As per the norm I am tired as hell and its 4AM. I just
want to figure out (or learn) which is faster. Do the operation via SQL if possible and
then store it, or issue vanilla queries and do everything myself with code.

Thanks and sorry for the incoherence (if any exists)!

-Lost

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация