开发者

select * math operations

开发者 https://www.devze.com 2023-01-04 20:02 出处:网络
is it possible to select colums and do complex operations on them for example selec开发者_如何学Ct factorial(column1) from table1 or select integral_of(something) from table2

is it possible to select colums and do complex operations on them for example selec开发者_如何学Ct factorial(column1) from table1 or select integral_of(something) from table2

perhaps there are libraries that support such operations?


Yes, you can call all pre-defined functions of your DB on the select columns and you can use CREATE FUNCTION to define your own.

But DBs are meant to wade through huge amounts of data, not to do complex calculations on them. If you try this, you'll find that many operations are awfully slow (especially the user defined ones).

Which is why most people fetch the data from the database and then do the complex math on the application side. This also makes it more simple to test and optimize the code or replace it with a new version.


Yes, it is. If the function you want is not built into your RDBMS, you can write your own User Defined Functions.

You'll find an example here: http://www.15seconds.com/Issue/000817.htm.

0

精彩评论

暂无评论...
验证码 换一张
取 消