Category: sql
postgresql and mysql difference in json format
Published on 09 Jun 2026
Explanation
PostgreSQL is an advanced open-source
relational
database known for strong SQL compliance,
analytics features, JSONB support,
and extensibility.
Code:
CREATE TABLE employees (id SERIAL PRIMARY KEY, name VARCHAR(100), salary NUMERIC(10,2));
Explanation
MySQL is a popular relational database
widely used in web applications due
to its simplicity, speed, and large
ecosystem.
Code:
CREATE TABLE employees (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), salary DECIMAL(10,2));
Explanation
PostgreSQL provides advanced analytical
capabilities such
as window functions, CTEs, materialized
views,
and multiple index types.
Code:
SELECT name, salary, RANK() OVER (ORDER BY salary DESC) AS rank_no FROM employees;
Explanation
MySQL is commonly chosen for CRUD
applications and supports stored procedures,
triggers,
views, and window functions in version
8.0+.
Code:
SELECT name, salary, ROW_NUMBER() OVER (ORDER BY salary DESC) AS row_num FROM employees;