MySQL Syntax for SQLite Syntax - mysql

I've started using SQLite for my Android applications. What I would like to know is where I can find a list of queries to use, are they the same for MySQL, and would I be able to use similar queries from MySQL?

SQLite provides a pretty good implementation of the SQL standard. Check out the syntax here. There is a prominent link in the first paragraph that describes omissions.
EDIT: No stored procedures or functions. You can mimic these in your code at runtime, however, using prepared statements

List of queries? You would need to use 'SQLiteDatabase.query' set of methods to query your SQLite database in your Android app. There would be SQLite specific SQL that you would need to consider while migrating your MySQL queries.

Related

Not able to convert METABASE QUESTIONS to sql query for mongodb

I am using metabase as BI tool for our analytics and my current database is in mongodb. I am able to create questions in metabase but when I try to join collections or try to do some complicated operations then I am not able to do that without writing in native query.
Is there any way to write sql queries for mongodb operations in metabase ? Or is there any other way around without using square and curly brackets for native query. And if I try to do with sql I get following error.
You can't. Since MongoDB is NoSQL you simply can't use SQL.
You can use the MongoDB native query language within Metabase.
Or you can wait for Apache Drill or Apache Spark SQL support:
https://github.com/metabase/metabase/issues/2157
Both solution would allow you to query MongoDB using SQL.
There is indeed limitation on metabase. However, I have helped our customer solve similar problems like yours. The software architecture is like this:
Metabase -> Presto SQL/Trino -> the data source that does not support SQL
In this design:
Metabase handles the dashboard part of work.
Trino translate SQL to
the query language that the data source can understand.
Note: In our customer's case, the integration really requires certain programming work. It is not a quite trivial job.

How do you test a SQL statements across multiple Database types?

Does anyone know of a quick and easy test to see if a query is properly formatted for both MySQL & MSSQL. Perhaps other database types as well, such as SQL Server? I only have access to MySQL at this time.
Info: I'm working on an Open Source project called JJWDesign Google Maps for SugarCRM. Some of the queries use the SugarCRM classes; others I have to write custom. For example, some are special distance calculations against the geocode information stored in the tables.
http://www.sugarforge.org/projects/jjwgooglemaps/
More importantly, while there is an accepted syntax, each flavour of database has it's own specific functions, features and things you can do.
The best you can do is to make do with the most basic of features. Oracle has different functions for datetime compared to mysql compared to db2. While I would love to assist in a 'free as in beer' project, you really will need to check each function to see if it is the same across all major vendors. General functions most often are, so abs() will be fairly consistent, but others simply won't.
You're talking about a SQL parser so by definition it either isn't going to be quick and easy or it will do only the simplest checking.
Each RDBMS has its own flavour of SQL too so you'd really be limited to testing whether it was ANSI SQL.

Good tool for converting mssql queries to mysql queries

I found alot of question on stack about converting mysql to mssql, but i would like to convert it otherwise.
From mssql server to mysql.
is there a (free) tool for this to do that without connecting to the databases?
i have an sql query dump and i want to convert that by putting that code in an tool.
Thanks.
You're probably best off doing this yourself to ensure everything is correct rather than relying on a third party tool (Also the additional benefit of understanding the differences between the two pieces of code). However you could use this SQL to MySQL tool:
http://download.cnet.com/SQL-To-MySQL-Converter/3000-10254_4-75693763.html

Need a tool to convert postgres database to mysql

I found the mysql migration toolkit which will migrate the tables.But is there something which will convert the functions as well.
Almost certainly not.
If your functions are in the SQL language only, it should probably be doable. But any of the many other languages supported by PostgreSQL (pl/pgsql, perl, python etc) are completely different, and contain much functionality that's simply not supported on MySQL.
most likely not. the stored procedure and function language differs greatly between postgresql and mysql. such an application would be costly to develop.
There are several data migration tools available on Google to convert database. I use dbload for example.

PL/Ruby equivalent in MySQL

PL/Ruby is a loadable procedural language for Postgres that lets you use Ruby to write user defined functions for the database.
Anyone know of an equivalent way of writing user defined functions for MySQL in Ruby?
Starting from version 5 (I think) Mysql supports stored procedures, but the syntax is restricted to SQL:2003 which is somewhat similar to PL/SQL.
Other languages aren't supported and I'm not aware of any projects offering ruby support. Last time I checked the PL/Ruby extensions to postgres were still a bit wonky as well, though.
Mysql as far as I am aware only supports MySQLs own stored procedure language.
I'm a postgresql fan too, and this is something that has always frustrated me about MySQL when I have had no choice but to use it. :(