MySQL JSON_TABLE – Map a JSON object to a relational database table

Introduction In this article, I’m going to explain how the MySQL JSON_TABLE function works, and how you can use it to transform a JSON object into a relational database table. When using a relational database system, it’s best to design the database schema according to the relational model. However, there are certain use cases when the relational model is too strict, and we are better off storing data in a JSON column type. For instance, as I explained in this article, when designing an audit log table, it’s much more convenient to… Read More

PostgreSQL audit logging using triggers

Introduction In this article, we are going to see how we can implement an audit logging mechanism using PostgreSQL database triggers to store the CDC (Change Data Capture) records. Thanks to JSON column types, we can store the row state in a single column, therefore not needing to add a new column in the audit log table every time a new column is being added to the source database table.

SQL ANY Operator – A Beginner’s Guide

Introduction In this article, we are going to see how the ANY operator works in SQL using it with a subquery or a VALUES clause, as well as its NULL value handling behavior.

MySQL audit logging using triggers

Introduction In this article, we are going to see how we can implement an audit logging mechanism using MySQL database triggers to store the old and new row states in JSON column types.

SQL JOIN USING – A Beginner’s Guide

Introduction In this article, we are going to see how the JOIN USING clause works in SQL, and how we can use it to replace the ON condition clause when the columns used to join the two tables have the same name in both the parent and the child tables.

SQL LEFT JOIN – A Beginner’s Guide

Introduction In this article, we are going to see how LEFT JOIN works in SQL, and how we can use it to associate rows belonging to different tables and build compound result sets. Unlike JOIN or INNER JOIN, LEFT JOIN is an OUTER JOIN. So, LEFT JOIN and LEFT OUTER JOIN are equivalent. Other OUTER JOIN types are RIGHT OUTER JOIN and FULL OUTER JOIN. However, since the SQL OUTER keyword is superfluous, it’s usually omitted.

SQL INNER JOIN – A Beginner’s Guide

Introduction In this article, we are going to see how INNER JOIN works in SQL, and how we can use it to associate rows belonging to different tables and build compound result sets.

SQL CROSS JOIN – A Beginner’s Guide

Introduction In this article, we are going to see how a CROSS JOIN works, and we will also make use of this SQL join type to build a poker card game.

How to get the query execution plan on SQL Server

Introduction In this article, we are going to see how we can get the query execution plan when using the SQL Server relational database system. The execution plan allows you to understand the operations done by the database engine when executing a specific SQL query.

How to get the SQL execution plan on Oracle

Introduction In this article, we are going to see how we can get the SQL execution plan on Oracle. When tuning performance, the execution plan is indispensable as it allows you to understand the operations done by the database when executing a certain SQL query.