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.
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.