pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<small id='MlWbY'></small><noframes id='MlWbY'>

<tfoot id='MlWbY'></tfoot>

      <bdo id='MlWbY'></bdo><ul id='MlWbY'></ul>

      <i id='MlWbY'><tr id='MlWbY'><dt id='MlWbY'><q id='MlWbY'><span id='MlWbY'><b id='MlWbY'><form id='MlWbY'><ins id='MlWbY'></ins><ul id='MlWbY'></ul><sub id='MlWbY'></sub></form><legend id='MlWbY'></legend><bdo id='MlWbY'><pre id='MlWbY'><center id='MlWbY'></center></pre></bdo></b><th id='MlWbY'></th></span></q></dt></tr></i><div class="hnbr77h" id='MlWbY'><tfoot id='MlWbY'></tfoot><dl id='MlWbY'><fieldset id='MlWbY'></fieldset></dl></div>
    1. <legend id='MlWbY'><style id='MlWbY'><dir id='MlWbY'><q id='MlWbY'></q></dir></style></legend>

        有沒有辦法在SQL中使用json對象

        Is there any way to use json objects in SQL(有沒有辦法在SQL中使用json對象)
          <tbody id='oS6F1'></tbody>

                <bdo id='oS6F1'></bdo><ul id='oS6F1'></ul>
                <i id='oS6F1'><tr id='oS6F1'><dt id='oS6F1'><q id='oS6F1'><span id='oS6F1'><b id='oS6F1'><form id='oS6F1'><ins id='oS6F1'></ins><ul id='oS6F1'></ul><sub id='oS6F1'></sub></form><legend id='oS6F1'></legend><bdo id='oS6F1'><pre id='oS6F1'><center id='oS6F1'></center></pre></bdo></b><th id='oS6F1'></th></span></q></dt></tr></i><div class="ljpn5bd" id='oS6F1'><tfoot id='oS6F1'></tfoot><dl id='oS6F1'><fieldset id='oS6F1'></fieldset></dl></div>
                <tfoot id='oS6F1'></tfoot>

                <small id='oS6F1'></small><noframes id='oS6F1'>

                • <legend id='oS6F1'><style id='oS6F1'><dir id='oS6F1'><q id='oS6F1'></q></dir></style></legend>
                  本文介紹了有沒有辦法在SQL中使用json對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  問題來了:

                  我們有一個 MySQL 數據庫,我們在其中存儲 JSON 字符串.直到現在這都沒問題,但突然我們的客戶要求我們對這些對象進行搜索/排序/其他操作.由于項目處于相當晚的狀態,去 Mongo 不是團隊負責人想要做出的選擇,所以我問有沒有一種快速的方法來使用這些 JSON 字符串?

                  We have a MySQL database in which we store JSON strings. Until now this was no problem, but suddenly our client requested we do search/order/other operations with these objects. Since the projects is at a fairly late state, going to Mongo is not a choice the team leader wants to make, so I'm asking is there a quick way to use these JSON strings?

                  推薦答案

                  JSON as Intention

                  在 MySQL 中無法使用 JSON.一些 DBMS 可能支持 JSON,但這是不可能的,此外,任何類型的支持"都只是關于執行一些特定于 JSON 的操作,而不是關于對您的架構進行建模(這兩件事完全不同)更多,從完整意義上講,MySQL 的模型概念(即關系)與 JSON 不同的是:作為關系 DBMS,它遵循 關系數據模型,和JSON是完全不同的格式.您將其存儲為純字符串值,因此,如果不使用字符串函數,則無法以其他方式對其進行任何操作.因此,即使使用 JSON,您也不會在關系模型中執行此操作,因此無法維護關系特性,例如參照完整性.

                  There is no way to work with JSON in MySQL. Some DBMS may support JSON, but that's out of the question, and, besides, any sort of such "support" is only about performing some JSON-specific operations, but not about modelling your architecture (and those two things are completely different) More, in full sense, model concept (i.e. relations) for MySQL is different than JSON is: as a Relational DBMS, it follows relational data model, and JSON is completely different format. You will store it as plain string value, thus, impossible to do anything with it in some other way, if not use string functions. So even working with JSON you will do that not inside relational model, thus, it won't be possible to maintain relational features, such as referential integrity, for instance.

                  解決方案

                  您有多種選擇:

                  • 遷移到 Postgree SQL,因為它擴展了對 json 的支持,從 9.4 版開始,它是 jsonb 甚至更快.這可能是最好的選擇,因為它是 RDBMS,因此遷移不會像真正面向文檔的 DBMS 那樣困難.
                  • 或者現在遷移到 Mongo(如果這是您的意圖),以免為時已晚.考慮到,Mongo 與 RDBMS 完全不同,它是面向文檔的.我想這對您的項目和您的客戶來說都是最好的選擇(而您的任務是解釋這一點)
                  • 更改整個架構,這樣您就不會存儲 JSON 對象,而是使用規范化(就關系數據庫而言)實體.這意味著 - 是的,對所有代碼進行完整重構,更改所有關系等.在實際情況下,這只是理論上的選擇,您不會為此獲得時間和金錢.
                  • 為 MySQL 實現您自己的 JSON 庫.難嗎?取決于你將用你的 JSON 做什么,但 JSON 是公共格式,所以你至少知道該怎么做.您可以作為 UDF 或在用戶處執行此操作土地(所以與 CREATE FUNCTION 聲明).當然,這將需要特定的技能和時間.壞事:錯誤.即使您能夠比重構架構或遷移到 Mongo 更快地創建這些功能,您也永遠無法確定這些功能的質量.沒有辦法在本地測試該代碼.但是,我可能會提示用戶級功能的情況 - 您可以使用 mysql-unit 測試您存儲的代碼,如果您的 MySQL 是 5.6 或更高版本(好吧,我已經編寫了這個工具,但是..它也可能包含錯誤)
                  • Migrate to Postgree SQL as it has extended support for json, since version 9.4 it's jsonb and it's even faster. This might be the best option since it's RDBMS and therefore the migration won't be that hard like for truly document-oriented DBMS.
                  • Or migrate to Mongo now (if that's your intention), before it's too late. Take in account, that Mongo is completely different thing than RDBMS, it's document-oriented. I guess this is the best option both for your project and for your client (and your task would be to explain that)
                  • Change entire architecture so you won't store JSON objects and will work with normalized (in terms of relation DB) entities. This means - yes, entire refactoring of all code, changing all relations etc. In real situation it's just theoretical option, you won't be given neither time nor money for that.
                  • Implement your own JSON library for MySQL. Is it hard? Depends of what you will do with your JSON, but JSON is public format, so you will know what to do, at least. You may do it either as UDF or at user-land (so with CREATE FUNCTION statement). This will require specific skills and time, of course. The bad things: bugs. Even if you'll be able to create those functions faster than re-structure your architecture or migrate to Mongo, you will never be certain of quality of those functions. There's no way to test that code natively. However, I may give hint for the case of user-land functions - you may use mysql-unit to test your stored code, if your MySQL is 5.6 or higher (well, I've written this tool, but.. it may contain bugs too)

                  標準"功能

                  最后,如果您運行的是 MySQL 5.7,那么預發布 JSON 函數可能會帶來一線希望 - 因此,您可以嘗試使用 JSON 功能的 alfa 版本,該功能目前存在于 MySQL 5.7.但我不會(強烈)建議在實際項目中使用它,因為這些功能既沒有經過充分測試也沒有完全完成.但是,要安裝這些功能,您需要下載相應的軟件包,然后將它們插入您的服務器,例如:

                  Finally, if you're running MySQL 5.7, then there may be a ray of hope with pre-release JSON functions - so, you may try to use alfa-version of JSON functionality, which currently exists for MySQL 5.7. But I would not (strongly) recommend to use that in real project since those functions are neither well-tested nor complete at all. But, to install those function, you'll need to download corresponding package, then plug them into your server, like:

                  CREATE FUNCTION json_append       RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_valid        RETURNS integer SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_extract      RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_replace      RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_remove       RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_set          RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_merge        RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_search       RETURNS string  SONAME 'libmy_json_udf.so';
                  CREATE FUNCTION json_contains_key RETURNS integer SONAME 'libmy_json_udf.so';
                  

                  之后你就可以嘗試它們了.

                  And after that you'll be able to try them.

                  這篇關于有沒有辦法在SQL中使用json對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                • <i id='RwvpX'><tr id='RwvpX'><dt id='RwvpX'><q id='RwvpX'><span id='RwvpX'><b id='RwvpX'><form id='RwvpX'><ins id='RwvpX'></ins><ul id='RwvpX'></ul><sub id='RwvpX'></sub></form><legend id='RwvpX'></legend><bdo id='RwvpX'><pre id='RwvpX'><center id='RwvpX'></center></pre></bdo></b><th id='RwvpX'></th></span></q></dt></tr></i><div class="57nlnnb" id='RwvpX'><tfoot id='RwvpX'></tfoot><dl id='RwvpX'><fieldset id='RwvpX'></fieldset></dl></div>
                        <tbody id='RwvpX'></tbody>

                        <bdo id='RwvpX'></bdo><ul id='RwvpX'></ul>

                            <legend id='RwvpX'><style id='RwvpX'><dir id='RwvpX'><q id='RwvpX'></q></dir></style></legend>
                            <tfoot id='RwvpX'></tfoot>
                          • <small id='RwvpX'></small><noframes id='RwvpX'>

                            主站蜘蛛池模板: 太平洋亲子网_健康育儿 品质生活| 宽带办理,电信宽带,移动宽带,联通宽带,电信宽带办理,移动宽带办理,联通宽带办理 | 拼装地板,悬浮地板厂家,悬浮式拼装运动地板-石家庄博超地板科技有限公司 | 广域铭岛Geega(际嘉)工业互联网平台-以数字科技引领行业跃迁 | 湖州织里童装_女童男童中大童装_款式多尺码全_织里儿童网【官网】-嘉兴嘉乐网络科技有限公司 | 半自动预灌装机,卡式瓶灌装机,注射器灌装机,给药器灌装机,大输液灌装机,西林瓶灌装机-长沙一星制药机械有限公司 | 国际船舶网 - 船厂、船舶、造船、船舶设备、航运及海洋工程等相关行业综合信息平台 | 南京种植牙医院【官方挂号】_南京治疗种植牙医院那个好_南京看种植牙哪里好_南京茀莱堡口腔医院 尼龙PA610树脂,尼龙PA612树脂,尼龙PA1010树脂,透明尼龙-谷骐科技【官网】 | 安徽合肥项目申报咨询公司_安徽合肥高新企业项目申报_安徽省科技项目申报代理 | 苏州注册公司_苏州代理记账_苏州工商注册_苏州代办公司-恒佳财税 | 软文世界-软文推广-软文营销-新闻稿发布-一站式软文自助发稿平台 | 有声小说,听书,听小说资源库-听世界网| 可程式恒温恒湿试验箱|恒温恒湿箱|恒温恒湿试验箱|恒温恒湿老化试验箱|高低温试验箱价格报价-广东德瑞检测设备有限公司 | 无锡门窗-系统门窗-阳光房-封阳台-断桥铝门窗厂[窗致美] | 大连海岛旅游网>>大连旅游,大连海岛游,旅游景点攻略,海岛旅游官网 | 小青瓦丨古建筑瓦丨青瓦厂家-宜兴市徽派古典建筑材料有限公司 | 并网柜,汇流箱,电控设备,中高低压开关柜,电气电力成套设备,PLC控制设备订制厂家,江苏昌伟业新能源科技有限公司 | 控显科技 - 工控一体机、工业显示器、工业平板电脑源头厂家 | 色油机-色母机-失重|称重式混料机-称重机-米重机-拌料机-[东莞同锐机械]精密计量科技制造商 | 集菌仪_智能集菌仪_全封闭集菌仪_无菌检查集菌仪厂家-那艾 | 无菌水质袋-NASCO食品无菌袋-Whirl-Pak无菌采样袋-深圳市慧普德贸易有限公司 | LHH药品稳定性试验箱-BPS系列恒温恒湿箱-意大利超低温冰箱-上海一恒科学仪器有限公司 | 上海租奔驰_上海租商务车_上海租车网-矢昂汽车服务公司 | 质检报告_CE认证_FCC认证_SRRC认证_PSE认证_第三方检测机构-深圳市环测威检测技术有限公司 | 水稻烘干机,小麦烘干机,大豆烘干机,玉米烘干机,粮食烘干机_巩义市锦华粮食烘干机械制造有限公司 水环真空泵厂家,2bv真空泵,2be真空泵-淄博真空设备厂 | 北京律师咨询_知名专业北京律师事务所_免费法律咨询 | 药品仓库用除湿机-变电站用防爆空调-油漆房用防爆空调-杭州特奥环保科技有限公司 | 郑州墨香品牌设计公司|品牌全案VI设计公司| 2025第九届世界无人机大会 | 拖鞋定制厂家-品牌拖鞋代加工厂-振扬实业中国高端拖鞋大型制造商 | 废旧物资回收公司_广州废旧设备回收_报废设备物资回收-益美工厂设备回收公司 | 淄博不锈钢,淄博不锈钢管,淄博不锈钢板-山东振远合金科技有限公司 | 天津试验仪器-电液伺服万能材料试验机,恒温恒湿标准养护箱,水泥恒应力压力试验机-天津鑫高伟业科技有限公司 | 中视电广_短视频拍摄_短视频推广_短视频代运营_宣传片拍摄_影视广告制作_中视电广 | 汽车水泵_汽车水泵厂家-瑞安市骏迪汽车配件有限公司 | 解放卡车|出口|济南重汽|报价大全|山东三维商贸有限公司 | Honsberg流量计-Greisinger真空表-气压计-上海欧臻机电设备有限公司 | PCB设计,PCB抄板,电路板打样,PCBA加工-深圳市宏力捷电子有限公司 | 欧必特空气能-商用空气能热水工程,空气能热水器,超低温空气源热泵生产厂家-湖南欧必特空气能公司 | 消电检公司,消电检价格,北京消电检报告-北京设施检测公司-亿杰(北京)消防工程有限公司 | 网络推广公司_网络营销方案策划_企业网络推广外包平台-上海澜推网络 |