Working with JSON in MySQL


Node and npm without sudo

Node.js Foundation

Modernizing Node.js with idiomatic JavaScript – Node.js Collection – Medium

Asynchronous PHP: Why?

200 universities just launched 600 free online courses.

Free Online HTML Classes - Find the Best Free Online HTML Classes for Programmers

Travis Bradberry

Science Says These Five Things Prove You're Smart

Study Reveals That Material Goods Don't Bring Happiness

Web 2.0 on Flipboard

Noman Ur Rehman

Working with JSON in MySQL

Ian Johnson

The Hitchhiker’s Guide to d3.js

Better Form Design: One Thing Per Page!

Sailing With Sails.js: An MVC-style Framework For Node.js – Smashing Magazine

What Everyone Should Know About The Process Behind App Design...

Why Laravel Development Is Popular Php Frameworks

You Might Not Need Underscore

Laurence Bradford

8 Tech Tools To Communicate Your Ideas More Effectively

5 predictions for artificial intelligence for for the coming year

Jose Aguinaga

How it feels to learn JavaScript in 2016

Adding and Leveraging a CDN on Your Website

5 Secret Hacks for More Powerful Web Designs

Philleep Florence

Get the next record in a SQL table!

Getting More with LESS! - Mixins!

Code Snippets - Get DOM Element Content

A New Year, A New Site

PhilleepEdit Webmaster

Philleep Florence Bug Tracker and Project Management has moved!

Code Snippets - HandleBars.js Helpers - ONE

2018-02-18 : 01:51

At this moment, you are probably asking yourself why would you want to use JSON when MySQL has been catering to a wide variety of database needs even before it introduced a JSON data type.

SQL databases tend to be rigid.

If you have worked with them, you would agree that database design though it seems easier, is a lot trickier in practice. SQL databases believe in structure, that is why it’s called structured query language.

On the other side of the horizon, we have the NoSQL databases, also called schema-less databases that encourage flexibility. In schema-less databases, there is no imposed structural restriction, only data to be saved.

Though every tool has it’s use case, sometimes things call for a hybrid approach.

What if you could structure some parts of your database and leave others to be flexible?

MySQL version 5.7.8 introduces a JSON data type that allows you to accomplish that.

In this tutorial, you are going to learn.

Learn JavaScript

Related Course

  1. How to design your database tables using JSON fields.
  2. The various JSON based functions available in MYSQL to create, read, update, and delete rows.
  3. How to work with JSON fields using the Eloquent ORM in Laravel.

#Why Use JSON

At this moment, you are probably asking yourself why would you want to use JSON when MySQL has been catering to a wide variety of database needs even before it introduced a JSON data type.

The answer lies in the use-cases where you would probably use a make-shift approach.

Let me explain with an example.

Suppose you are building a web application where you have to save a user’s configuration/preferences in the database.

Generally, you can create a separate database table with the id, user_id, key, and value fields or save it as a formatted string that you can parse at runtime.

However, this works well for a small number of users. If you have about a thousand users and five configuration keys, you are looking at a table with five thousand records that address a very small feature of your application.

Or if you are taking the formatted string route, extraneous code that only compounds your server load.

Using a JSON data type field to save a user’s configuration in such a scenario can spare you a database table’s space and bring down the number of records, which were being saved separately, to be the same as the number of users.

And you get the added benefit of not having to write any JSON parsing code, the ORM or the language runtime takes care of it.

Learn more from @nomanurrehman on
Philleep Florence LLC

This unknown unknown does not support some features required to view Philleep Florence LLC. Please download a newer unknown Browser.

Philleep Florence LLC
Philleep Florence LLC
Image Preview