Different databases have slight versions within their implementations of SQL. Does PDO handle this?

Basically write an SQL query which i use with PDO to gain access to a MySQL database, and then tell PDO to begin using a different sort of database, will the query cease working? Or will PDO 'convert' the query to ensure that it is constantly on the work?

If PDO doesn't do that, what are the PHP libraries that let me write SQL according to particular syntax, and so the library will handle transforming the SQL to ensure that it'll operate on different databases?

From PHP manual :

PDO supplies a data-access abstraction layer, meaning, no matter which database you are using, you utilize exactly the same functions to problem queries and fetch data. PDO doesn't give a database abstraction it does not rewrite SQL or emulate missing features. You need to use a full-blown abstraction layer should you need that facility.

So,you can't alter the database and expect that everything works as before. It is dependent around the queries you've used. Could they be "simple" SQL92 queries or will they use special features for any specific db...

Ex a mysql query with "LIMIT 10,20" should be rewritting to utilize an Oracle DB or Sqlite. They will use "LIMIT 20 OFFSET 10"

PHP does not have libraries which will instantly convert SQL for you personally. If you would like that type of functionality you should think about an ORM implementation like Doctrine. There's a cost to pay for obviously, since there's a learning curve involved with utilizing it inside your project, plus writting SQL stops being as easy as producing a string. You need to request yourself should you absolutely positively need code that's database independent.