5

Please suggest any MySQL 5.5+ Engine that can support collection of key-value pairs be stored in any column of a table.

I don't know if this feature is available out of the box in MySQL like PostgreSQL equivalent to HSTORE which is immensely useful and adds some of NoSQL benefits ..

Example in PostgreSQL -

SELECT 'a=>1,a=>2'::hstore;
 hstore
----------
 "a"=>"1"

source - http://www.postgresql.org/docs/current/static/hstore.html

Hannah Vernon
71.1k22 gold badges178 silver badges323 bronze badges
asked Mar 22, 2013 at 11:02
1

1 Answer 1

0
-- For MySQL 5.7+
CREATE TABLE your_table_5_7 (
 id INT PRIMARY KEY,
 data JSON
);
INSERT INTO your_table_5_7 (id, data)
VALUES (1, '{"a": 1, "b": 2}');
SELECT data->'$.a' AS value_a, data->'$.b' AS value_b
FROM your_table_5_7;
answered Jul 16, 2023 at 17:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.