Facebook invite mysql hierarchical queries instead use postgresql - mysql

I've seen few posts here saying I can do hierarchical queries using mysql.
I've not used PostgreSQL, yet. If I change to PostgreSQL, do I have to change a lot of syntax or can I do that hierarchical stuff in MySQL itself?
Hierarchical queries in MySQL
What sender sends is Facebook invite so can I do this in SQL?

MySQL doesn't have recursive queries, databases like PostgreSQL, SQL Server and Oracle do have these types of queries. Very powerful and easy to use, but in MySQL you're on your own.
You could use a work around like a nested set, works in almost any database but is not as fast.

Related

Can I use either SQL, MySQL or SQLite to read a SQL database?

I'm not very versed on databases, so thismight sound wrong to some of you: Can I use SQL, MySQL and/or SQLite to read the same database? If so, are there commands or instructions I should keep an eye on to not make a mess on the tables?
Thanks in advance!
sql is a language. sqlite and mysql are database engines.
Both SQLite and MySQL (as far as any SQL engines) allows SQL language to manipulate database content (with some engine specific ).
So you may use SQL to read a MySQL or SQLite database. But be aware that SQL use in each is engine dependent. For instance, in SQLite you may use shell application, c wrapper, ... For MySQL you may use php wrapper, ...

Querying data by joining two tables in two databases (different database types) on different servers

I have a MS SQL (SQL Server 2008) database with some data in it and a postgresql (9) database with other data. I need to do some queries to find related data. I know how to link two MS SQL databases together but not sure how to even start with the mixed database types.
The new company I work for has postgresql, I have not worked with it before. The guy I replaced was really the only one here who knew much about it. So no internal resources.
I'm not ready to build a solution in code at this point (.NET), just hoping to have a tool to do some queries.
Postgresql has table
Company
Company_id, Company_name, ....
MS SQL had table
Companies
company_name, postgresql_company_id, company_id, ....
If you ever need to run queries from Postgres that pulls data from SQL-Server, you can use foreign data wrappers. The ODBC driver should work fine:
http://wiki.postgresql.org/wiki/Foreign_data_wrappers
I'm not familiar enough with SQL-Server to give an authoritative answer on how to do it the other way around, but since Postgres speaks ODBC, I'm guessing it's close enough to how you make a SQL-Server talk with another one.
Related thread: SQL Server 2012: Add a linked server to PostgreSQL

T-SQL connector for MySQL

Is there any way to use T-SQL queries with MySQL database, like having a data connector that understand TSQL and can connect to MySQL?
Short answer, no.
By the time you've developed or found an interface that could translate T-SQL syntax into MySQL (correctly); you might as well have learnt the syntax required to write the MySQL you need.
It's not all that different to be honest; and it will broaden your knowledge and make you flexible for other types of database query languages.

Combine MYSQL & Postgresql

I have two different sites in my Intranet.. 1st site Database is MYSQL, & second one is in Postgresql. how can I combine both database?
Another possibility is to use fdw (in PostgreSQL 9.1) to comunicate both databases, and an example of this. However, for now, has some limitations.
You simply can't on a database level.
You can however use some language which has drivers for both and 'combine' them on a application level.

What are the SQL Server query syntax not supported by MySQL?

I am working in a project where we are using SQL Server database currently. But recently a decision has been taken that the database will be changed to MySQL.
I am not using any stored procedures, views, triggers, user defined functions, etc. But I think even then some queries written for SQL Server will not be supported by MySQL.
Can anyone help: what are the things that I have to check (and change) so that all the queries will work properly for MySQL also?
Queries that I know without consulting the documentation that will not work:
(recursive) common table expressions
windowing functions
queries using the standard SQL string concatenation ||
UPDATEs with JOIN are different between the two systems
Date arithmetics: date_column + 1 behaves differently in SQL Server
Division by zero will produce an error
SQL Server will reject values that do not fit into a column (instead of silently truncating it, which MySQL does in the default installation)
DDL that will not work and might have an impact on performance and/or data quality
datetime columns where you need precision up to milliseconds
tables with check constraints
indexed views
triggers on views
table functions (select * from my_function(42);)
filtered indexes ("partial index")
function based indexes
There's always the option to take commercial support from MySQL AB for this problem. I'm pretty sure they've done enough MSSQL->MySQL migrations to know alot about that. If a price tag on the migration is not a problem.
Alternatively, you could try to run the MySQL Migration Toolkit over the data and look for meaningful error messages at the stuff it cannot migrate. MySQL Migration Toolkit is part of the MySQL GUI Tools.