MySQL Max()函数

MySQL Max()函数

MySQL Max() 函数是用来找出记录集中最大值的记录。

要理解 Max() 函数,考虑 employee_tbl 表,它是具有以下记录:

mysql> SELECT * FROM employee_tbl;
+------+------+------------+--------------------+
| id   | name | work_date  | daily_typing_pages |
+------+------+------------+--------------------+
|    1 | John | 2007-01-24 |                250 |
|    2 | Ram  | 2007-05-27 |                220 |
|    3 | Jack | 2007-05-06 |                170 |
|    3 | Jack | 2007-04-06 |                100 |
|    4 | Jill | 2007-04-06 |                220 |
|    5 | Zara | 2007-06-06 |                300 |
|    5 | Zara | 2007-02-06 |                350 |
+------+------+------------+--------------------+
7 rows in set (0.00 sec)

现在,假设想获取上表中daily_typing_pages的字段的最大值对应的记录, 那么可以简单地使用下面的命令:

mysql> SELECT MAX(daily_typing_pages)
    -> FROM employee_tbl;
+-------------------------+
| MAX(daily_typing_pages) |
+-------------------------+
|                     350 |
+-------------------------+
1 row in set (0.00 sec)

可以使用GROUP BY子句找到所有记录中最大值对应的名字如下:

mysql> SELECT id, name, MAX(daily_typing_pages)
    -> FROM employee_tbl GROUP BY name;
+------+------+-------------------------+
| id   | name | MAX(daily_typing_pages) |
+------+------+-------------------------+
|    3 | Jack |                     170 |
|    4 | Jill |                     220 |
|    1 | John |                     250 |
|    2 | Ram  |                     220 |
|    5 | Zara |                     350 |
+------+------+-------------------------+
5 rows in set (0.00 sec)

可以使用 Min() 函数和 Max() 函数一起,找出最小值和最大值。试试下面的例子:

mysql> SELECT MIN(daily_typing_pages) least, MAX(daily_typing_pages) max
    -> FROM employee_tbl;
+-------+------+
| least | max  |
+-------+------+
|   100 |  350 |
+-------+------+
1 row in set (0.01 sec)

95 Responses

  1. Uwyjyh说道:

    escitalopram 10mg brand purchase revia for sale revia 50mg pill

  2. Vvakpi说道:

    purchase furosemide generic order ventolin generic ventolin 4mg price

  3. Kdorsm说道:

    buy strattera pills order sertraline 50mg sale buy sertraline 50mg generic

  4. Yvpfox说道:

    ursodiol 150mg tablet brand zyrtec 5mg order zyrtec 10mg pills

  5. Onnbez说道:

    buy azithromycin 250mg for sale buy omnacortil 40mg generic buy gabapentin 100mg without prescription

  6. Drjmxa说道:

    medication that reduces stomach acid best drug for heartburn prescription strength gas relief medication

  7. Powgtj说道:

    prednisone 5mg uk order generic accutane 10mg order amoxil 1000mg generic

  8. Qoxked说道:

    help paying for birth control micturition syncope nhs what makes you last longer

  9. Lffeid说道:

    promethazine 25mg usa best ed pills at gnc cost of ivermectin pill

  10. Zqupiz说道:

    drugs used to treat ulcers classifications of antiarrhythmic agents get antibiotic for uti online

  11. Ctnwzs说道:

    cymbalta 20mg price order glipizide without prescription provigil order online

  12. Xhpxbn说道:

    supplement for fungus on skin stopping blood pressure medication symptoms common blood pressure medicine names

  13. Zsbvza说道:

    order cyproheptadine online cheap order fluvoxamine online order ketoconazole pill

  14. Cporgb说道:

    buy herpes drugs drugs to treat prediabetes best a1c best lowering drug

  15. Funluw说道:

    medroxyprogesterone without prescription buy microzide online cheap hydrochlorothiazide 25 mg uk

  16. Fcasjt说道:

    fda approved smoking cessation medications injectable med for rheumatoid arthritis buy painkillers without an rx

  17. Yqqxcz说道:

    buy generic letrozole over the counter albendazole 400mg cheap aripiprazole 30mg usa

  18. Vmphxn说道:

    order uroxatral generic purchase alfuzosin without prescription best heartburn relief fast

  19. Rkaxlw说道:

    minomycin over the counter buy terazosin requip 2mg drug

  20. Vcsitv说道:

    buy pills to treat acne acne treatment brand names trileptal 600mg generic

  21. Fincpt说道:

    buy catapres pills order spiriva 9mcg pill order tiotropium bromide without prescription

  22. Qmgktz说道:

    brand rocaltrol 0.25mg buy trandate 100 mg generic fenofibrate for sale

  23. Uejpfw说道:

    buy trimox pills for sale oral arimidex buy macrobid paypal

  24. Gpjtqn说道:

    buy custom research papers writing a biographical essay buy generic cefixime online

  25. Pvwozl说道:

    aspirin for sale online slots slots games

  26. Mmvpxz说道:

    buy terbinafine sale best online casinos play poker online

  27. Jzjdsz说道:

    order ceftin online cheap buy generic lumigan order robaxin without prescription

  28. Fesiyh说道:

    order tadalafil 20mg pill buy tadacip 10mg online indomethacin 75mg cost

  29. Ekrnps说道:

    generic nolvadex 10mg buy symbicort inhalers rhinocort tablet

  30. Yfgtza说道:

    retin cream cheap purchase retin sale buy avana online

  31. Ohwovx说道:

    order lamictal 200mg online cheap buy minipress 2mg sale mebendazole online order

  32. Ftpxfi说道:

    oral metronidazole 200mg purchase keflex online cheap purchase keflex sale

  33. Bblzbl说道:

    buy generic aurogra over the counter sildenafil overnight shipping estrace 2mg tablet

  34. Vnbzyw说道:

    buy fluconazole cheap order fluconazole 200mg without prescription baycip order

  35. Addgof说道:

    cheap custom essay buy nothing day essay letter writing services

  36. Flfqsy说道:

    order flomax 0.2mg without prescription purchase ondansetron online cheap simvastatin 10mg usa

  37. Nxwtbo说道:

    order buspirone 5mg online cheap buy generic buspar over the counter amiodarone for sale online

  38. Ntbyty说道:

    buy ranitidine 150mg generic buy meloxicam tablets purchase celecoxib

  39. Lqbczx说道:

    buy zyloprim 100mg without prescription purchase temovate without prescription buy generic rosuvastatin

  40. Vvxtdm说道:

    buy cheap imitrex buy avodart 0.5mg for sale order dutasteride online

  41. Acybtg说道:

    buy nexium 20mg generic purchase remeron online cheap buy generic topiramate online

  42. Svsgba说道:

    purchase azelastine online cheap purchase avapro sale buy avapro paypal

  43. Onoqdj说道:

    buy generic famotidine over the counter order famotidine 20mg sale tacrolimus 5mg price

  44. Owvhqe说道:

    buy xenical sale order xenical 120mg brand diltiazem 180mg

  45. Iosgrk说道:

    order coumadin 5mg buy paxil 20mg online buy generic reglan over the counter

  46. Ombzeq说道:

    buy pamelor 25 mg pill buy paracetamol without prescription cheap paracetamol

  47. Hduqhd说道:

    order generic inderal 10mg purchase motrin for sale order clopidogrel 150mg

  48. Xvcywf说道:

    purchase fosamax pill colchicine 0.5mg usa order nitrofurantoin 100mg pills

  49. Dtyhgn说道:

    amaryl online order order etoricoxib 60mg generic etoricoxib oral

  50. Vptptq说道:

    order baclofen 25mg for sale purchase toradol pill toradol order online

  51. Pysmwb说道:

    purchase loratadine generic buy priligy without prescription buy priligy 30mg for sale

  52. Zmuwzb说道:

    order baclofen 10mg online cheap ketorolac brand buy ketorolac medication

  53. Jczjnf说道:

    buy phenytoin 100 mg generic phenytoin for sale ditropan 2.5mg over the counter

  54. Ifcdpb说道:

    perindopril pills clarinex 5mg sale allegra where to buy

  55. Rriims说道:

    buy levitra 20mg buy tizanidine 2mg generic purchase tizanidine generic

  56. Ruaxke说道:

    buy methylprednisolone 4mg how to buy triamcinolone triamcinolone 10mg canada

  57. Wcqxuq说道:

    buy generic clomid 100mg brand imuran buy azathioprine 50mg for sale

  58. Qdwdzc说道:

    roulette games online slots for real money cheap generic levothroid

  59. Xffayg说道:

    amantadine pills order atenolol 100mg without prescription aczone 100mg cost

  60. Hobdwm说道:

    real casinos online no deposit roulette free play for fun stromectol tablet 3 mg

  61. Lxkvyx说道:

    blackjack for money purchase vibra-tabs generic buy albuterol without prescription

  62. Tbyglp说道:

    protonix where to buy phenazopyridine 200 mg ca pyridium 200mg cheap

  63. Brlfgd说道:

    gambling sites lasix 100mg sale furosemide 40mg us

  64. Ftqgcy说道:

    atorvastatin 80mg cheap norvasc without prescription amlodipine order

  65. Xjehim说道:

    buy azipro 250mg for sale neurontin 600mg without prescription order gabapentin 100mg pill

  66. Ddcqso说道:

    accutane cost order isotretinoin 10mg generic azithromycin 500mg us

  67. Mathewwar说道:

    Anna Berezina is a eminent framer and demagogue in the field of psychology. With a training in clinical psychology and voluminous research experience, Anna has dedicated her career to understanding human behavior and mental health: https://diigo.com/0tugd5. Middle of her between engagements, she has мейд relevant contributions to the grassland and has become a respected meditation leader.

    Anna’s judgement spans several areas of thinking, including cognitive disturbed, favourable psychology, and ardent intelligence. Her comprehensive facts in these domains allows her to victual valuable insights and strategies for individuals seeking in the flesh increase and well-being.

    As an originator, Anna has written distinct controlling books that have garnered widespread perception and praise. Her books tender down-to-earth information and evidence-based approaches to help individuals lead fulfilling lives and reveal resilient mindsets. Via combining her clinical expertise with her passion on helping others, Anna’s writings secure resonated with readers roughly the world.

  68. Gdsazt说道:

    cheap cefdinir order prevacid generic lansoprazole us

  69. Trrryc说道:

    modafinil cheap purchase phenergan online cheap deltasone 10mg sale

  70. Xmnvic说道:

    cialis prices genuine cialis sildenafil 50mg for sale

  71. Skpmkf说道:

    buy telmisartan for sale buy plaquenil 400mg sale purchase molnunat generic

  72. Ylkgzh说道:

    oral prilosec buy montelukast 5mg buy metoprolol 100mg

  73. Nkbzho说道:

    premarin pills sildenafil on line cheap generic sildenafil

  74. Nankgz说道:

    buy betahistine 16mg pill zovirax buy online probenecid over the counter

  75. Davidval说道:

    Altogether! Conclusion expos‚ portals in the UK can be unendurable, but there are numerous resources ready to cure you espy the unexcelled identical as you. As I mentioned before, conducting an online search with a view https://kitjohnson.co.uk/pag/learn-how-to-outsmart-fake-news.html “UK newsflash websites” or “British information portals” is a pronounced starting point. Not only desire this give you a encyclopaedic slate of hearsay websites, but it determination also afford you with a improved brainpower of the coeval communication scene in the UK.
    In the good old days you have a liber veritatis of embryonic account portals, it’s critical to evaluate each undivided to influence which overwhelm suits your preferences. As an case, BBC News is known quest of its intention reporting of information stories, while The Trustee is known quest of its in-depth opinion of political and social issues. The Disinterested is known championing its investigative journalism, while The Times is known in the interest of its business and investment capital coverage. By arrangement these differences, you can select the information portal that caters to your interests and provides you with the news you have a yen for to read.
    Additionally, it’s worth considering close by news portals because proper to regions within the UK. These portals produce coverage of events and news stories that are applicable to the область, which can be exceptionally cooperative if you’re looking to hang on to up with events in your neighbourhood pub community. For occurrence, local good copy portals in London contain the Evening Standard and the Londonist, while Manchester Evening News and Liverpool Repercussion are in demand in the North West.
    Blanket, there are diverse tidings portals available in the UK, and it’s high-level to do your digging to find the joined that suits your needs. By evaluating the contrasting news portals based on their coverage, style, and position statement angle, you can select the a person that provides you with the most apposite and engrossing news stories. Meet fortunes with your search, and I hope this data helps you find the practised dope portal for you!

  76. Trfqhm说道:

    zovirax uk order capecitabine 500 mg online cheap order generic rivastigmine 3mg

  77. Qxokeu说道:

    enalapril 5mg cheap vasotec pills buy lactulose paypal

  78. DanielPom说道:

    Europe is a continent with a rich history and diverse culture. Life in Europe varies greatly depending on the provinces and область, but there are some commonalities that can be observed.
    United of the defining features of lifestyle in Europe is the strong force on work-life balance. Many European countries have laws mandating a certain amount of vacation speedily for workers, and some have even experimented with shorter workweeks. This allows for more just the same from time to time forth with next of kin and pursuing hobbies and interests.
    http://valla-cranes.co.uk/wp-content/pages/meet-anna-berezina_4.html
    Europe is also known for its flush cultural heritage, with numberless cities boasting centuries-old architecture, astuteness wiles, and literature. Museums, galleries, and factual sites are profuse, and visitors can bury themselves in the history and customs of the continent.
    In annex to cultural attractions, Europe is effectively to a wide variety of consonant beauty. From the complete fjords of Norway to the cheery beaches of the Mediterranean, there is no deficiency of superb landscapes to explore.
    Of speed, spring in Europe is not without its challenges. Innumerable countries are grappling with issues such as profits inequality, immigration, and bureaucratic instability. Yet, the people of Europe are resilient and get a long portrayal of overcoming adversity.
    Overall, vigour in Europe is invaluable and varied, with something to present oneself in the course of everyone. Whether you’re interested in information, refinement, nature, or altogether enjoying a appropriate work-life steadiness, Europe is a titanic lodgings to entitle home.

  79. Wlyzwg说道:

    oral pyridostigmine 60 mg feldene 20mg sale buy generic maxalt 10mg

  80. Ewprli说道:

    ferrous without prescription order ascorbic acid 500 mg for sale betapace uk

  81. AngelWom说道:

    Бурение скважин на водичку – этто процесс создания отверстий в течение земле чтобы извлечения подземных вод, коие смогут употребляться для различных полнее, начиная питьевую воду, полив растений, промышленные нужды да другие: https://etextpad.com/d7a2jvmzt8. Чтобы бурения скважин используют специализированное оборудование, такое яко буровые конструкции, коим проходят в течение землю да создают дыры глубиной через пары десятков ут пары сотен метров.
    Через некоторое время формирования скважины коротится стресс-тестирование, чтоб сосчитать нее производительность и штрих воды. Через некоторое время щель снабжается насосом и прочими организациями, чтоб защитить хронический доступ буква воде. Хотя бы бурение скважин на водичку представляет необходимую цена в обеспечивании доступа к чистой водопитьевой восе а также утилизируется в течение различных отраслях индустрии, текущий процесс что ль показывать негативное воздействие сверху окружающую среду. Поэтому необходимо соблюдать подходящие философия также регуляции.

  82. Jarvisheido说道:

    Эмпайр скважин на водичку – это эпидпроцесс организации отверстий в почве чтобы извлечения подземных вод. Эти скважины используются чтобы водопитьевой вода, полива растений, индустриальных нищенствования и других целей. Процесс бурения скважин охватывает на себя использование специализированного снабжения, таковского яко бурильные блоки, которые проникают в матушку-землю и создают отверстия: https://courses.9marks.org/members/marymap1/activity/421751/. Данные скважины обычно владеют глубину через нескольких 10-ов до пары сотен метров.
    После формирования скважины, спецы обжуливают стресс-тестирование, чтоб фиксировать нее эффективность и штрих воды. Затем щель снабжается насосом (а) также другими построениями, чтоб обеспечить постоянный доступ ко воде. Эмпайр скважин на водичку представляет собой важным ходом, яже гарантирует впуск. ant. выход буква прямою хозпитьевой здесь а также утилизируется в различных секторах экономики промышленности. Что ни говорите, текущий процесс что ль носить отрицательное воздействие на охватывающую слой, поэтому что поделаешь выдерживать сообразные правила и регуляции.

  83. Xkmkqq说道:

    prasugrel pill pill detrol 1mg buy detrol paypal

  84. Michaeladoto说道:

    To read actual rumour, adhere to these tips:

    Look for credible sources: https://projectev.co.uk/wp-content/pages/index.php?who-owns-hygo-news.html. It’s eminent to secure that the news origin you are reading is reliable and unbiased. Some examples of good sources include BBC, Reuters, and The Different York Times. Review multiple sources to pick up a well-rounded sentiment of a isolated statement event. This can better you listen to a more complete display and keep bias. Be aware of the perspective the article is coming from, as flush with good hearsay sources can be dressed bias. Fact-check the gen with another fountain-head if a scandal article seems too unequalled or unbelievable. Many times fetch persuaded you are reading a fashionable article, as expos‚ can change-over quickly.

    Nearby following these tips, you can become a more informed rumour reader and more wisely apprehend the beget here you.

  85. Vrxoli说道:

    buy monograph 600mg pills cilostazol 100 mg generic cilostazol usa

  86. Ynepuv说道:

    florinef 100 mcg pills buy generic aciphex 20mg order loperamide generic

  87. Snyapj说道:

    order dydrogesterone for sale jardiance 10mg canada empagliflozin 10mg canada

  88. Jtrqys说道:

    order melatonin online cheap aygestin 5mg price order danazol 100mg pills

  89. Fnaull说道:

    order dipyridamole 25mg how to buy dipyridamole pravastatin 20mg cheap

  90. Tlaosg说道:

    order generic aspirin 75 mg buy imiquad cream zovirax for sale

  91. Hhwdog说道:

    precose for sale online prandin medication purchase griseofulvin online

  92. Kjxqdw说道:

    mintop tablet ed solutions best natural ed pills

  93. Yxdogm说道:

    order ketotifen generic order doxepin generic tofranil 25mg us

  94. Dyffvw说道:

    cialis next day delivery sildenafil online buy viagra 100mg pill

  95. Ijlrir说道:

    fenofibrate 200mg without prescription buy fenofibrate 160mg generic order fenofibrate online

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

CAPTCHAis initialing...