Sqlite: select sqrt()

Hi Taifun and all,
I use the sqlite extention to call "select id,sqrt(id) from tabelle". ( the id is in the table)
"select id from tabelle" works.
same with ... power(id,2) ...

The function is not available, but in https://sqlite.org/lang_mathfunc.html#pow the functions are listed.
So I guess your sqlite is with less functions? Or what can I do?

The sqlite application is on your device, not a part of the extension. It may not have all the functions that the main linux/windows sqlite application has, this will depend on what (version) the vendor installs, and how they compile it...

From your link:

The math functions shown below are part of the SQLite amalgamation source file but are only active if the amalgamation is compiled using the -DSQLITE_ENABLE_MATH_FUNCTIONS compile-time option.

[edit]You are lucky, my device doesn't even have sqlite installed on it! Found it now !

1 Like

That means my app may not run on other devices? :flushed:

Sorry, I have no idea, what you are speaking off. That is over my knowledge. :grin:


From the link you posted, it just explains that sqlite must be compiled with maths functions enabled for maths functions to be available in the sqlite application. It is quite possible that the compile on your device does not have these functions. Do any of the other maths functions work ?

@TIMAI2 which device do you have? and what is its Android version?
this is the first time I hear, that sqlite is not available on an Android device...


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

I just tried my app on an Galayy S2 and sqlite works, But my formula sqrt() did not work on S9
But I changed my sql using an other formula, which gives an enough accurate result.

I think I have no choice to implement sqrt() in my device. If the sqlite is only basic it's ok. It is only bad if you spend time searching the error when there is no error, only a missing option.#

thank you, I now added this into the documentation in Q16 here https://puravidaapps.com/sqlite.php#q

Sqlite was not present on my HTC 10 (Android 7) nor is it available on my Google Pixel 4a (Android 11).
[edit] Found it now, buried deep inside android - well, Taifun's sqlite extension works, just can't access from Juan's terminal extension.

This is why I had a look at a solution to use sqlite using the Termux App.

according to this https://benchmarks.ul.com/en/hardware/phone/HTC+10+Evo+review and https://benchmarks.ul.com/en/hardware/phone/Google+Pixel+4A+review

there are benchmarks for reading/writing the Sqlite database for both devices... so Sqlite seems to be available... very strange...


I don't understand why you need the square root of what must be an identifier, judging by its name (id).

I also don't understand why you don't just use the AI2 math block for sqrt on the id that arrives from the SQL result.

This post was flagged by the community and is temporarily hidden.

Well, don't feel it offensive but, helping in someone's problem is more necessary than just pointing out spelling mistakes. The community is for helping each other and sorting spelling mistakes isn't a too good idea :bulb:

the sqrt shall bei in the where clause. I tested it in the simple sql statement and saw, that this function seem not to be included.

As previously posted: