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

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

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

    1. <legend id='mGOCW'><style id='mGOCW'><dir id='mGOCW'><q id='mGOCW'></q></dir></style></legend>
    2. MySQL中的排名函數(shù)

      Rank function in MySQL(MySQL中的排名函數(shù))

        <tbody id='Czhi6'></tbody>

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

          1. <tfoot id='Czhi6'></tfoot>
          2. <i id='Czhi6'><tr id='Czhi6'><dt id='Czhi6'><q id='Czhi6'><span id='Czhi6'><b id='Czhi6'><form id='Czhi6'><ins id='Czhi6'></ins><ul id='Czhi6'></ul><sub id='Czhi6'></sub></form><legend id='Czhi6'></legend><bdo id='Czhi6'><pre id='Czhi6'><center id='Czhi6'></center></pre></bdo></b><th id='Czhi6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Czhi6'><tfoot id='Czhi6'></tfoot><dl id='Czhi6'><fieldset id='Czhi6'></fieldset></dl></div>
              • <bdo id='Czhi6'></bdo><ul id='Czhi6'></ul>
                <legend id='Czhi6'><style id='Czhi6'><dir id='Czhi6'><q id='Czhi6'></q></dir></style></legend>
              • 本文介紹了MySQL中的排名函數(shù)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我需要找出客戶的等級.在這里,我根據(jù)我的要求添加了相應(yīng)的 ANSI 標(biāo)準 SQL 查詢.請幫我把它轉(zhuǎn)換成 MySQL.

                I need to find out rank of customers. Here I am adding the corresponding ANSI standard SQL query for my requirement. Please help me to convert it to MySQL .

                SELECT RANK() OVER (PARTITION BY Gender ORDER BY Age) AS [Partition by Gender], 
                  FirstName, 
                  Age,
                  Gender 
                FROM Person
                

                MySQL 中是否有查詢排名的函數(shù)?

                Is there any function to find out rank in MySQL?

                推薦答案

                一種選擇是使用排名變量,例如:

                One option is to use a ranking variable, such as the following:

                SELECT    first_name,
                          age,
                          gender,
                          @curRank := @curRank + 1 AS rank
                FROM      person p, (SELECT @curRank := 0) r
                ORDER BY  age;
                

                (SELECT @curRank := 0) 部分允許變量初始化,而無需單獨的 SET 命令.

                The (SELECT @curRank := 0) part allows the variable initialization without requiring a separate SET command.

                測試用例:

                CREATE TABLE person (id int, first_name varchar(20), age int, gender char(1));
                
                INSERT INTO person VALUES (1, 'Bob', 25, 'M');
                INSERT INTO person VALUES (2, 'Jane', 20, 'F');
                INSERT INTO person VALUES (3, 'Jack', 30, 'M');
                INSERT INTO person VALUES (4, 'Bill', 32, 'M');
                INSERT INTO person VALUES (5, 'Nick', 22, 'M');
                INSERT INTO person VALUES (6, 'Kathy', 18, 'F');
                INSERT INTO person VALUES (7, 'Steve', 36, 'M');
                INSERT INTO person VALUES (8, 'Anne', 25, 'F');
                

                結(jié)果:

                +------------+------+--------+------+
                | first_name | age  | gender | rank |
                +------------+------+--------+------+
                | Kathy      |   18 | F      |    1 |
                | Jane       |   20 | F      |    2 |
                | Nick       |   22 | M      |    3 |
                | Bob        |   25 | M      |    4 |
                | Anne       |   25 | F      |    5 |
                | Jack       |   30 | M      |    6 |
                | Bill       |   32 | M      |    7 |
                | Steve      |   36 | M      |    8 |
                +------------+------+--------+------+
                8 rows in set (0.02 sec)
                

                這篇關(guān)于MySQL中的排名函數(shù)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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 個先前值來決定接下來的 N 個行)
                reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結(jié)果;條款?)
                Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項是忽略整個事務(wù)還是只是有問題的行?) - IT屋-程序員軟件開發(fā)技
                Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 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 時發(fā)生錯誤 沒有合適的驅(qū)動程序)
                How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫表作為 Spark 數(shù)據(jù)幀讀取?)

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

                <tfoot id='Ya6rJ'></tfoot>

                  • <i id='Ya6rJ'><tr id='Ya6rJ'><dt id='Ya6rJ'><q id='Ya6rJ'><span id='Ya6rJ'><b id='Ya6rJ'><form id='Ya6rJ'><ins id='Ya6rJ'></ins><ul id='Ya6rJ'></ul><sub id='Ya6rJ'></sub></form><legend id='Ya6rJ'></legend><bdo id='Ya6rJ'><pre id='Ya6rJ'><center id='Ya6rJ'></center></pre></bdo></b><th id='Ya6rJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Ya6rJ'><tfoot id='Ya6rJ'></tfoot><dl id='Ya6rJ'><fieldset id='Ya6rJ'></fieldset></dl></div>
                      <tbody id='Ya6rJ'></tbody>
                      <legend id='Ya6rJ'><style id='Ya6rJ'><dir id='Ya6rJ'><q id='Ya6rJ'></q></dir></style></legend>
                        • <bdo id='Ya6rJ'></bdo><ul id='Ya6rJ'></ul>
                          主站蜘蛛池模板: 国产精品免费观看视频 | 国产免费一区二区三区网站免费 | 日韩电影免费观看中文字幕 | 成人av在线大片 | 久久亚洲一区二区 | 91精品国产一区二区三区蜜臀 | 久久久99国产精品免费 | 精精久久 | 亚洲性视频 | 日韩精品一区在线观看 | 成年男女免费视频网站 | 精品视频久久久 | 国产a视频 | 99久久婷婷国产综合精品电影 | 日韩午夜 | 成人一区精品 | 日日干干夜夜 | 新91| 久久精品99久久 | 2019天天干夜夜操 | 亚洲h视频 | 久久精品成人 | 午夜小影院 | 亚洲第一区久久 | 欧美专区在线观看 | 亚洲精品一区二区三区蜜桃久 | 狼色网 | 成人h动漫精品一区二区器材 | 欧美一区二区久久 | 亚洲欧美激情四射 | 亚洲国产aⅴ成人精品无吗 欧美激情欧美激情在线五月 | 午夜精品三区 | 99精品久久久久久 | 91se在线 | 蜜桃视频在线观看免费视频网站www | 亚洲免费三区 | 亚洲精品久久 | 久久精品亚洲国产 | 亚洲第一区国产精品 | 91视频精选 | 毛片网络 |