Using JSON as a Data Type

Using JSON as a Data Type

MySQL is a very robust database that supports JSON as a data type. This will be very useful for applications that need the JSON data type for certain types of processing.

Consider the following example, here, we will create, populate and query the JSON data, which should clarify its usage.


For table creation:


For data insertion in table

INSERT INTO EMP_DETAILS VALUES (1, 'John', 'win', '{"masters": "Algorithms", "bachelors": "Computer Science"}');INSERT INTO EMP_DETAILS VALUES (2, 'Brian', 'Lee', '{"masters": "Data Science", "bacherlors": "Computer Science"}');INSERT INTO EMP_DETAILS VALUES (3, 'Steve', 'wall', '{"masters": "Optimization", "bacherlors": "Computer Science"}'); 

And, we now want to extract the values in the masters field of the JSON object for all the rows, we have the query as defined below.



+---------------------+| ID  | QUALIFICATION |+---------------------+|  1  | Algorithms    ||  2  | Data Science  ||  3  | Optimization  |+---------------------+

Please observe the ->>, which extracts only the text that is intended.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes