|
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]
|