Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8713549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:22:07+00:00 2026-06-13T05:22:07+00:00

Ive been trying to make a new MySQL view without Json from an existing

  • 0

Ive been trying to make a new MySQL view without Json from an existing MySQL table which contain some Json objects. Table 1 is the current table. Table 2 is the new MySQL view derived from Table 1. The content of table 2 will always reflect table 1 content. The difference is just the structure.

Below are simplified tables for our example context where actually there are more than 20 columns.

Table 1 (3 columns)

user_id | name |          params
---------------------------------------------
   1    | john |{"age":"26","gender":"male"}
   2    | amy  |{"age":"28","gender":"female"}

Table 2 (4 columns)

user_id | name | age | gender
-----------------------------
   1    | john | 26  | male
   2    | amy  | 28  | female

The data flow is like this:
At anytime, user key in data from 3rd party custom form and got saved into Table 1. The data however need to be pulled from the Table 2 format, also at anytime.

How can we achieve this using only SQL queries? Thank you in advance. This will sure helps many developers out there coping with Json as new standard. Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:22:08+00:00Added an answer on June 13, 2026 at 5:22 am

    You can do this with a rather ugly combination of string functions, assuming your table2 above:

    SELECT user_id,name,
    substring_index(substring(params,locate('age":"',params)+6),'"',1) as age 
    from table_2
    

    You can follow the same pattern for gender.

    This is a bit fragile based on how consistently you JSON is formatted.

    Forgot to mention the docs can be viewed at: MySQL docs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ive been trying to make a form with drop downs which are populated from
I've been trying to make some applications which all rely on the same library,
this has been an ongoing problem with me, ive been trying to make a
I've been trying to make this script from ClearBox3 to stop conflicting with MooTools
I'm new in html5 and its websocket! now I've been trying to make my
Ive been trying to create this code for some time now and just wondered
I've been trying to make this for 2 days, I apologize I'm new to
I have been unsuccessfully trying to make a List which contains 3 picturebox controls(picturebox1,
I'm completely new to Python and I've been trying to make a fibonacci program
I've been trying to make some methods that will sort a linked list by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.