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

      <i id='7Nndi'><tr id='7Nndi'><dt id='7Nndi'><q id='7Nndi'><span id='7Nndi'><b id='7Nndi'><form id='7Nndi'><ins id='7Nndi'></ins><ul id='7Nndi'></ul><sub id='7Nndi'></sub></form><legend id='7Nndi'></legend><bdo id='7Nndi'><pre id='7Nndi'><center id='7Nndi'></center></pre></bdo></b><th id='7Nndi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7Nndi'><tfoot id='7Nndi'></tfoot><dl id='7Nndi'><fieldset id='7Nndi'></fieldset></dl></div>
        <bdo id='7Nndi'></bdo><ul id='7Nndi'></ul>
    1. <small id='7Nndi'></small><noframes id='7Nndi'>

    2. <legend id='7Nndi'><style id='7Nndi'><dir id='7Nndi'><q id='7Nndi'></q></dir></style></legend>
      <tfoot id='7Nndi'></tfoot>

        您可以拆分/分解 MySQL 查詢中的字段嗎?

        Can you split/explode a field in a MySQL query?(您可以拆分/分解 MySQL 查詢中的字段嗎?)

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

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

            1. <tfoot id='loPyY'></tfoot>
                <tbody id='loPyY'></tbody>
                <legend id='loPyY'><style id='loPyY'><dir id='loPyY'><q id='loPyY'></q></dir></style></legend>

                  <bdo id='loPyY'></bdo><ul id='loPyY'></ul>
                • 本文介紹了您可以拆分/分解 MySQL 查詢中的字段嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我必須創建一份關于一些學生完成情況的報告.每個學生都屬于一個客戶.這是表格(針對此問題進行了簡化).

                  I have to create a report on some student completions. The students each belong to one client. Here are the tables (simplified for this question).

                  CREATE TABLE  `clients` (
                    `clientId` int(10) unsigned NOT NULL auto_increment,
                    `clientName` varchar(100) NOT NULL default '',
                    `courseNames` varchar(255) NOT NULL default ''
                  )
                  

                  courseNames 字段包含以逗號分隔的課程名稱字符串,例如AB01,AB02,AB03"

                  The courseNames field holds a comma-delimited string of course names, eg "AB01,AB02,AB03"

                  CREATE TABLE  `clientenrols` (
                    `clientEnrolId` int(10) unsigned NOT NULL auto_increment,
                    `studentId` int(10) unsigned NOT NULL default '0',
                    `courseId` tinyint(3) unsigned NOT NULL default '0'
                  )
                  

                  此處的courseId 字段是clients.courseNames 字段中課程名稱的索引.因此,如果客戶端的courseNames 是AB01,AB02,AB03",并且注冊的courseId2,那么學生在AB03.

                  The courseId field here is the index of the course name in the clients.courseNames field. So, if the client's courseNames are "AB01,AB02,AB03", and the courseId of the enrolment is 2, then the student is in AB03.

                  有沒有辦法可以在這些表上進行單一選擇,其中包括課程名稱?請記住,會有來自不同客戶的學生(因此具有不同的課程名稱,并非所有課程名稱都是連續的,例如:NW01,NW03")

                  Is there a way that I can do a single select on these tables that includes the course name? Keep in mind that there will be students from different clients (and hence have different course names, not all of which are sequential,eg: "NW01,NW03")

                  基本上,如果我可以拆分該字段并從結果數組中返回單個元素,那將是我正在尋找的.這是我在神奇偽代碼中的意思:

                  Basically, if I could split that field and return a single element from the resulting array, that would be what I'm looking for. Here's what I mean in magical pseudocode:

                  SELECT e.`studentId`, SPLIT(",", c.`courseNames`)[e.`courseId`]
                  FROM ...
                  

                  推薦答案

                  直到現在,我都想在我的 SQL 數據庫中保留那些逗號分隔的列表 - 非常了解所有警告!

                  Until now, I wanted to keep those comma separated lists in my SQL db - well aware of all warnings!

                  我一直認為它們比查找表(它提供了一種標準化數據庫的方法)有好處.經過幾天的拒絕,我看到了曙光:

                  I kept thinking that they have benefits over lookup tables (which provide a way to a normalized data base). After some days of refusing, I've seen the light:

                  • 在一個字段中使用逗號分隔值時,使用查找表不會產生比那些丑陋的字符串操作更多的代碼.
                  • 查找表允許使用本機數字格式,因此不會比那些 csv 字段大.雖然它更小.
                  • 涉及的字符串操作在高級語言代碼(SQL 和 PHP)中很少,但與使用整數數組相比成本很高.
                  • 數據庫不應該是人類可讀的,因為它們的可讀性/直接可編輯性而試圖堅持結構,這在很大程度上是愚蠢的,就像我所做的一樣.

                  簡而言之,MySQL 沒有原生的 SPLIT() 函數是有原因的.

                  In short, there is a reason why there is no native SPLIT() function in MySQL.

                  這篇關于您可以拆分/分解 MySQL 查詢中的字段嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 數據幀讀取?)

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

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

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

                            主站蜘蛛池模板: 亚洲成人一区二区三区 | 欧美一区二区三区在线观看 | 国产精品不卡一区 | 黄色一级免费看 | 在线播放亚洲 | 国产一区二区在线免费观看 | japan21xxxxhd美女 日本欧美国产在线 | 紧缚调教一区二区三区视频 | 先锋av资源在线 | 欧美激情久久久 | 国产精品a久久久久 | 亚洲精品久久久久久国产精华液 | 亚洲综合免费 | 尤物视频在线免费观看 | 综合国产第二页 | 全部免费毛片在线播放网站 | 成人国产精品久久 | 亚洲一页 | 国产高清视频 | 最新国产在线 | 久久久国产一区二区三区四区小说 | 国产最新视频在线 | 精品乱人伦一区二区三区 | 中文字幕亚洲一区二区三区 | 亚洲 欧美 日韩 精品 | 黄色免费观看网站 | 一级毛片免费看 | 久久综合国产精品 | 日韩视频在线播放 | 亚洲综合国产精品 | 成年人视频免费在线观看 | 久久亚洲视频 | 国产sm主人调教女m视频 | 美女一级黄 | 国产欧美一区二区三区在线看蜜臀 | 一区二区三区在线播放 | 午夜欧美a级理论片915影院 | 91在线中文字幕 | 精品视频久久久久久 | 综合欧美亚洲 | 久久精彩视频 |