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

<tfoot id='s54FU'></tfoot>
    • <bdo id='s54FU'></bdo><ul id='s54FU'></ul>

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

        <legend id='s54FU'><style id='s54FU'><dir id='s54FU'><q id='s54FU'></q></dir></style></legend>

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

        從另一列計(jì)算的列?

        Column calculated from another column?(從另一列計(jì)算的列?)
        • <small id='ve9wK'></small><noframes id='ve9wK'>

          • <bdo id='ve9wK'></bdo><ul id='ve9wK'></ul>
              <tfoot id='ve9wK'></tfoot>

                  <tbody id='ve9wK'></tbody>

                <i id='ve9wK'><tr id='ve9wK'><dt id='ve9wK'><q id='ve9wK'><span id='ve9wK'><b id='ve9wK'><form id='ve9wK'><ins id='ve9wK'></ins><ul id='ve9wK'></ul><sub id='ve9wK'></sub></form><legend id='ve9wK'></legend><bdo id='ve9wK'><pre id='ve9wK'><center id='ve9wK'></center></pre></bdo></b><th id='ve9wK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ve9wK'><tfoot id='ve9wK'></tfoot><dl id='ve9wK'><fieldset id='ve9wK'></fieldset></dl></div>
              1. <legend id='ve9wK'><style id='ve9wK'><dir id='ve9wK'><q id='ve9wK'></q></dir></style></legend>
                  本文介紹了從另一列計(jì)算的列?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  給定下表:

                  id | value
                  --------------
                  1     6
                  2     70
                  

                  有沒(méi)有辦法添加一個(gè)基于同一個(gè)表中的另一列自動(dòng)計(jì)算的列?類似于 VIEW,但屬于同一個(gè)表的一部分.例如,calculated 將是 value 的一半.Calculated 應(yīng)該在 value 更改時(shí)自動(dòng)更新,就像 VIEW 一樣.

                  Is there a way to add a column that is automatically calculated based on another column in the same table? Like a VIEW, but part of the same table. As an example, calculated would be half of value. Calculated should be automatically updated when value changes, just like a VIEW would be.

                  結(jié)果是:

                  id | value | calculated
                  -----------------------
                  1     6       3
                  2     70      35
                  

                  推薦答案

                  Generated Column 是 MySql 5.7.6 及以上版本的好方法之一.

                  Generated Column is one of the good approach for MySql version which is 5.7.6 and above.

                  生成的列有兩種:

                  • 虛擬(默認(rèn)) - 列將在運(yùn)行時(shí)計(jì)算從表中讀取記錄
                  • Stored - 列將在在表中寫入/更新新記錄

                  兩種類型都可以有 NOT NULL 限制,但只有存儲(chǔ)的 Generated Column 可以是索引的一部分.

                  Both types can have NOT NULL restrictions, but only a stored Generated Column can be a part of an index.

                  對(duì)于當(dāng)前情況,我們將使用存儲(chǔ)的生成列.為了實(shí)現(xiàn),我認(rèn)為計(jì)算所需的兩個(gè)值都存在于表中

                  For current case, we are going to use stored generated column. To implement I have considered that both of the values required for calculation are present in table

                  CREATE TABLE order_details (price DOUBLE, quantity INT, amount DOUBLE AS (price * quantity));
                  
                  INSERT INTO order_details (price, quantity) VALUES(100,1),(300,4),(60,8);
                  

                  amount 會(huì)自動(dòng)彈出到表格中,您可以直接訪問(wèn)它,另外請(qǐng)注意,每當(dāng)您更新任何列時(shí),amount 也會(huì)更新.

                  amount will automatically pop up in table and you can access it directly, also please note that whenever you will update any of the columns, amount will also get updated.

                  這篇關(guān)于從另一列計(jì)算的列?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數(shù)根據(jù) N 個(gè)先前值來(lái)決定接下來(lái)的 N 個(gè)行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達(dá)式的結(jié)果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項(xiàng)是忽略整個(gè)事務(wù)還是只是有問(wèn)題的行?) - IT屋-程序員軟件開(kāi)發(fā)技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時(shí)出錯(cuò),使用 for 循環(huán)數(shù)組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調(diào)用 o23.load 時(shí)發(fā)生錯(cuò)誤 沒(méi)有合適的驅(qū)動(dòng)程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫(kù)表作為 Spark 數(shù)據(jù)幀讀取?)
                    <bdo id='qLySx'></bdo><ul id='qLySx'></ul>
                    • <small id='qLySx'></small><noframes id='qLySx'>

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

                          • <tfoot id='qLySx'></tfoot>
                              <tbody id='qLySx'></tbody>
                            <legend id='qLySx'><style id='qLySx'><dir id='qLySx'><q id='qLySx'></q></dir></style></legend>
                            主站蜘蛛池模板: 三级黄片毛片 | 国产精品亚洲成在人线 | av中文字幕网 | 91豆花视频 | 久久av一区二区三区 | 亚洲精品国产第一综合99久久 | 欧美色综合网 | 免费看国产精品视频 | 亚洲一区中文 | 久久高清| 久久精品成人 | 狠狠干天天干 | 久久国产精品久久久久久久久久 | 美女视频久久 | 九九精品久久久 | 少妇黄色 | 伊人二区 | 成人精品一区二区三区中文字幕 | 91人人爽 | 精品国产欧美一区二区 | 天天躁日日躁狠狠很躁 | 久久久久久久久久久丰满 | 在线视频中文字幕 | 日韩欧美成人一区二区三区 | 亚洲成人一区 | 亚洲视频在线一区 | 色毛片 | 国产成人免费视频网站视频社区 | 人人射人人插 | 国产www成人| 中文在线播放 | 亚洲乱码一区二区三区在线观看 | 欧美日韩视频在线 | 国产91av视频在线观看 | 中文字幕不卡在线观看 | 皇色视频在线 | 国产成人久久精品 | 亚洲精品丝袜日韩 | 亚洲一区二区精品视频 | 五月天激情综合网 | 青青久久|