mysql 5 functions

mysql 5 functions

am 10.02.2006 19:38:02 von m6s

I downloaded mysql, I did rpm -e to take out the 3.22 from my box (
mandrake 9.x)
I put MySQL 5, because someone told me it supports at last functions..
If anybody knows, can someone tell me, whether I can make functions like
in sql server of microsoft or not?
I want to implement some basic statistical functions like mean ,
deviation e.t.c.
But what I found on net is about UDF and staff for compiling mysql again
for native code...
I didn't find much for functions...
some examples also for procedures didn;t work...

Another thing, I noticed that some of those examples were on a file in
the disk in some mysql place...In windows environment that should be
under c:\mysql. In Linux?

Re: mysql 5 functions

am 10.02.2006 21:02:39 von smatta

Be aware that mysql has those funcs built into sql. std and others as
well. I dont have it in front of me. Check the doc.

Re: mysql 5 functions

am 10.02.2006 21:19:02 von Bill Karwin

"Dimitris Mexis" wrote in message
news:dsimi7$jrl$1@ulysses.noc.ntua.gr...
> I want to implement some basic statistical functions like mean, deviation
> ...

Before implementing new functions, see if MySQL already provides the ones
you need. It provides AVERAGE(), STDDEV_POP(), STDDEV_SAMP(), VAR_POP() and
VAR_SAMP.
Docs can be found here:
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.ht ml

I assume AVERAGE is the arithmetic mean. AFAIK, MySQL does not provide a
function for the geometric mean.

> Another thing, I noticed that some of those examples were on a file in the
> disk in some mysql place...In windows environment that should be under
> c:\mysql. In Linux?

The command "rpm -ql" should list the files installed by an RPM package.

Regards,
Bill K.

Re: mysql 5 functions

am 10.02.2006 21:36:16 von m6s

smatta@acm.org wrote:
> Be aware that mysql has those funcs built into sql. std and others as
> well. I dont have it in front of me. Check the doc.
>
I understand that and I am about to check it, but what if I want to add
new functions?
I guess normal and binomial distributions are not in a packet such as a
database!

Re: mysql 5 functions

am 10.02.2006 22:11:50 von m6s

Hmm
I found my error was that I didn't use the switch of delimiter...
BUT!
in functions now how can I accomplish the operator like?

select suma(price) from tblEmployee where tblEmployee like pName

this in the function produces error because it dislikes the 'like'
?!?!?

Re: mysql 5 functions

am 10.02.2006 22:13:20 von m6s

Ok I got it!
I had not used the switch of delimiter....
fool of me :-)

Thank you!

Re: mysql 5 functions

am 10.02.2006 22:29:43 von Bill Karwin

"m6s" wrote in message
news:dsivik$19ra$1@ulysses.noc.ntua.gr...
> select suma(price) from tblEmployee where tblEmployee like pName
>
> this in the function produces error because it dislikes the 'like'
> ?!?!?

Tables aren't like values -- fields are like values.

e.g.
select suma(price) from tblEmployee where tblEmployee.someFieldName like
pName

Regards,
Bill K.

Re: mysql 5 functions

am 10.02.2006 23:50:19 von m6s

I cancelled this message to be seen, but it seems that pop3 decided to
show it...pf!
:-)
Yes i saw my error, and was tricky as I was frustrated from the build up
proccess of the function...
for some 500 rows, the deviation gave me 0.09 seconds
I have mysql 5, on a pentium celeron 366
is this time good enough for this PC?
if I place it on a 64bit server let's say, would this be drastically
eliminated?
In the bottom line what i am interested in is thefact that I do some
statistical computations and I want to be "web"...so I am trying to see
the best solution for the speed...mysql functions...PHP functions...or
some user-client-windows environment....
if for only 500 rows takes 0.09 and make mysql seem as stack..not good...

any suggestion?