Working with JSON in MySQL

...

thoughtco.com

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

Travis Bradberry

Science Says These Five Things Prove You're Smart

dmarge.com

Study Reveals That Material Goods Don't Bring Happiness

flipboard.com

Web 2.0 on Flipboard

Noman Ur Rehman

Working with JSON in MySQL

Ian Johnson

The Hitchhiker’s Guide to d3.js

smashingmagazine.com

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

bestdesign2themes.com

Why Laravel Development Is Popular Php Frameworks

reindex.io

You Might Not Need Underscore

Laurence Bradford

8 Tech Tools To Communicate Your Ideas More Effectively

readwrite.com

5 predictions for artificial intelligence for for the coming year

Jose Aguinaga

How it feels to learn JavaScript in 2016

css-tricks.com

Adding and Leveraging a CDN on Your Website

lifehack.org

5 Secret Hacks for More Powerful Web Designs

androidauthority.com

Google Wallet's new web app is here!

Serdar Yegulalp

5 wicked-fast Python frameworks you have to try

hbr.org

Machine Learning Is No Longer Just for Experts

humaan.com

Custom HTML Markers with Google Maps - Websites, Mobile and eCommerce – Humaan

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

2017-10-17 : 03:25


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


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