久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" 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="qwawimqqmiuu" 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="qwawimqqmiuu" 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'>

                            主站蜘蛛池模板: 亚洲福利| 亚洲一区二区三区免费在线观看 | 国产伦精品一区二区三区精品视频 | 久久影院一区 | 日韩国产精品一区二区三区 | 久久一级 | 久久久999精品 | ww 255hh 在线观看 | 99re在线视频 | 亚洲精品一区在线观看 | 日韩精品1区2区3区 成人黄页在线观看 | 欧美色999| 精品不卡 | 日韩国产高清在线观看 | 亚洲综合五月天婷婷 | 国产精久久久久久久 | 91麻豆精品国产91久久久更新资源速度超快 | 国内精品一区二区三区 | 日韩免费看视频 | 成人夜晚看av | 中文字幕一区二区三 | 欧美另类视频 | 欧美在线网站 | 日韩在线欧美 | 九九热在线视频 | 欧美综合国产精品久久丁香 | 国产毛片久久久 | 成人免费看片又大又黄 | 亚洲 欧美 另类 综合 偷拍 | 天天综合久久网 | 91在线精品一区二区 | 精国产品一区二区三区 | 亚洲精品乱码 | 伊人国产精品 | 亚洲每日更新 | 91在线网站 | 久久99深爱久久99精品 | 男女羞羞视频在线观看 | 日本精品国产 | 久久免费精品 | 91精品国产高清久久久久久久久 |