在mysql中存储JSON数据 [英] storing JSON data in mysql
本文介绍了在mysql中存储JSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有,例如组织表
ID, name, address, phone, email, etc...
现在我想添加多个地址,电话和电子邮件。
Now I want to add multiple addresses, phones and emails.
它是存储在像这样的email列JSON数据的好办法
Is it a good way to store json data in email column like this
[ "address2@example2.com", "address2@example2.com", "address2@example2.com" ]
或创建另一个表只是电子邮件,另一个用于手机等......
Or create another table just for emails and another for phones etc...
如果存储JSON数据是更好? - 什么是在轨使用它的最佳方式。
If storing json data is better - what is the best way to use it in rails?
推荐答案
下面是我发现
http://api.rubyonrails.org/classes/ActiveRecord/Base.html
保存阵列,在文本列散列和其它非可映射对象
Saving arrays, hashes, and other non-mappable objects in text columns
这篇关于在mysql中存储JSON数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文