I am going through a course in Udemy that teaches SQL using PostgreSQL. Yesterday I wanted to solve some SQL questions on Hackerrank. But it does not have the option to write in PostgreSQL. It has options to write SQL using using DB2, MySQL, Oracle and MS SQL Server. Could you please advice which of these is nearest to PostgreSQL in terms of Syntax so that I can spend minimal time in re-skilling? Thanks.


MySQL queries are, in most cases, exactly the same as PostgreSQL queries. Like PostgreSQL, MySQL uses tables as a core component and has more or less the same feature set as PostgreSQL. If you just use basic SQL, then you will hardly notice any difference between PostgreSQL and MySQL.

| improve this answer | |

There is a standard for the SQL language. That standard has grown and evolved over the years, with various editions published over decades.

Many databases claim to support various editions of the standard. However, no database has implemented all of the standard completely. And all databases extend the standard, adding commands and features beyond those defined in the standard. Every SQL database on the market is both a subset and a superset of the standard.

So your Question is impossible to answer. SQL is too vast and the database systems too diverse to make any kind of sensible conclusion about the closeness of similarity. All SQL database systems are quite similar to each other versus non-SQL databases, but they are also quite different. Learning about these differences, and learning to live with them, is just part of life if you intend to write portable code.

Postgres makes a priority of complying with the standard. And one can argue Postgres is one of the most compliant implementations of the standard. The documentation is quite good about describing aspects of the standard and then describing how Postgres does or does not implement those.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.