MySQL Min()函数

MySQL Min()函数

MySQL的Min()函数用来找出记录集的最小值纪录。

理解Min()函数,考虑一个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 MIN(daily_typing_pages)
    -> FROM employee_tbl;
+-------------------------+
| MIN(daily_typing_pages) |
+-------------------------+
|                     100 |
+-------------------------+
1 row in set (0.00 sec)

使用GROUP BY子句找到所有每个名称最小值的记录如下:

mysql>SELECT id, name, MIN(daily_typing_pages)
    -> FROM employee_tbl GROUP BY name;
+------+------+-------------------------+
| id   | name | MIN(daily_typing_pages) |
+------+------+-------------------------+
|    3 | Jack |                     100 |
|    4 | Jill |                     220 |
|    1 | John |                     250 |
|    2 | Ram  |                     220 |
|    5 | Zara |                     300 |
+------+------+-------------------------+
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)

98 Responses

  1. Twxacz说道:

    order viagra 50mg – sildenafil 100mg uk cialis 20mg over the counter

  2. Wrzphm说道:

    buy tizanidine no prescription – purchase hydrochlorothiazide sale buy microzide 25 mg for sale

  3. Zeoknb说道:

    buy augmentin 375mg – buy nizoral 200mg online order generic duloxetine

  4. Xmlqer说道:

    where can i buy prednisolone – buy azipro 500mg for sale buy generic prometrium online

  5. Ukbuzr说道:

    buy generic accutane 10mg – decadron order online linezolid order

  6. Gfivpc说道:

    buy augmentin 375mg order augmentin 625mg pills clomid 50mg oral

  7. Dbroke说道:

    buy generic lexapro buy escitalopram 20mg online cheap buy naltrexone medication

  8. Yhbvjj说道:

    lasix where to buy buy ventolin sale order ventolin 2mg pills

  9. Ipuneu说道:

    buy strattera 25mg generic order generic sertraline 100mg order sertraline

  10. Xvhngy说道:

    actigall 300mg sale buy generic bupropion buy cetirizine 5mg for sale

  11. Ermwzj说道:

    sucralfetprin stomach coating medication best medicine for acid reflux stinky fart pills

  12. Vtcljf说道:

    deltasone 40mg generic amoxicillin canada order generic amoxicillin

  13. Rzgmng说道:

    walgreens birth control pills price how to last longer men exercises to cure premature ejaculation

  14. Vxqqdt说道:

    purchase phenergan sale buy phenergan pills stromectol 3mg cost

  15. Kesywv说道:

    what causes duodenal erosion hypertensive crisis treatment drugs uti treatment online prescription

  16. Acyedo说道:

    duloxetine 20mg over the counter duloxetine brand provigil generic

  17. Mxkdox说道:

    fungal nail tablets blood pressure medication with least side effects beverages that lower blood pressure

  18. Xdureg说道:

    buy generic cyproheptadine for sale periactin where to buy buy nizoral without prescription

  19. Ssbclc说道:

    nhs stop smoking clinic online doctor consultation pain prescription buy prescription pain pills online

  20. Yohkma说道:

    medroxyprogesterone 5mg us medroxyprogesterone over the counter buy microzide 25mg online

  21. Iiprip说道:

    virtual visit online physician belsomra topical dutasteride for hair loss online weight loss doctor prescription

  22. Wvldsq说道:

    purchase femara order albenza online cheap abilify 30mg us

  23. Whhwms说道:

    generic alfuzosin 10mg meds for vomiting anti nausea medication brand names

  24. Pacgpx说道:

    buy minocin pill minocin usa buy ropinirole pills

  25. Vaccsq说道:

    buy acne pills online best doctor prescribed acne medication trileptal 300mg brand

  26. Gqfbgw说道:

    clonidine 0.1 mg usa spiriva 9 mcg ca oral tiotropium bromide 9mcg

  27. Ludmnk说道:

    rocaltrol 0.25mg for sale rocaltrol 0.25mg brand order generic tricor 200mg

  28. Azltdx说道:

    how to buy trimox buy arimidex no prescription order biaxin 500mg generic

  29. Jaatol说道:

    practice essay writing online best online casino free poker games

  30. Vzeulg说道:

    professional letter writing services science article reviews cefixime for sale online

  31. Kfjpaj说道:

    buy aspirin sale win real money online instantly no deposit free slots casino games

  32. Cknejc说道:

    buy generic lamisil for sale casino real money free play real money blackjack

  33. Bpspst说道:

    how to buy trazodone buy clindac a cheap buy clindamycin cheap

  34. Zwpbzr说道:

    order cefuroxime for sale buy robaxin pills for sale buy methocarbamol 500mg pill

  35. Gzwlak说道:

    buy tadalafil for sale purchase tadacip pills buy indocin 75mg generic

  36. Tcavie说道:

    buy nolvadex paypal order symbicort generic budesonide cost

  37. Rpchrw说道:

    retin cream for sale buy retin generic buy avanafil 100mg online

  38. Wgssle说道:

    cleocin 300mg pill erectile dysfunction pills over the counter purchase fildena without prescription

  39. Uhzyyz说道:

    order lamictal 50mg generic minipress 2mg sale buy mebendazole paypal

  40. Jlbfny说道:

    metronidazole 200mg tablet metronidazole 200mg over the counter keflex 125mg over the counter

  41. Dgetxk说道:

    diflucan canada fluconazole buy online buy ciprofloxacin medication

  42. Ytxcft说道:

    order aurogra 50mg online oral sildalis buy estradiol no prescription

  43. Awrsnt说道:

    aldactone ca brand spironolactone 100mg order finasteride sale

  44. Ofitox说道:

    pay for assignment how to write an essay about my family websites to write essays

  45. Fbyzet说道:

    order flomax 0.2mg sale cheap zocor 10mg buy simvastatin 20mg online

  46. Zmuxqb说道:

    buy domperidone 10mg online sumycin medication order sumycin 250mg without prescription

  47. Njljqc说道:

    zantac price mobic pills buy celebrex online

  48. Rueoxd说道:

    buspirone 5mg over the counter oral cordarone cordarone for sale online

  49. Vsnvdb说道:

    imitrex 25mg pills imitrex 25mg usa dutasteride for sale online

  50. Xznzcg说道:

    order zyloprim 300mg online cheap buy generic zyloprim online buy crestor 20mg generic

  51. Oshqji说道:

    buy esomeprazole cheap buy nexium generic buy generic topamax

  52. Ndkjko说道:

    famotidine 20mg tablet famotidine 40mg usa prograf 5mg price

  53. Xulzsp说道:

    astelin 10 ml ca avalide order irbesartan canada

  54. Mexnlp说道:

    buy warfarin maxolon medication reglan tablet

  55. Ozxmpj说道:

    buy cheap orlistat buy mesalamine order diltiazem 180mg online cheap

  56. Wjcmob说道:

    order nortriptyline online order pamelor 25 mg online cheap buy anacin pills for sale

  57. Dflmjc说道:

    buy propranolol online clopidogrel medication clopidogrel cost

  58. Ebyygq说道:

    alendronate pill nitrofurantoin 100 mg tablet nitrofurantoin us

  59. Msgbja说道:

    order amaryl 4mg order generic misoprostol 200mcg buy etoricoxib 60mg online

  60. Xcwbxq说道:

    buy lioresal sale ketorolac without prescription buy toradol 10mg pill

  61. Upyhvd说道:

    baclofen pills buy baclofen pills buy cheap ketorolac

  62. Hhwwoe说道:

    purchase loratadine pills buy priligy online order dapoxetine 90mg online

  63. Qrvmtw说道:

    buy phenytoin 100mg online cheap order ditropan 5mg order ditropan 5mg generic

  64. Tjyluo说道:

    vardenafil 10mg usa order levitra 20mg pill tizanidine 2mg us

  65. Kjcuzk说道:

    buy clomiphene generic order imdur sale purchase imuran generic

  66. Mahhea说道:

    medrol over counter buy adalat 10mg generic triamcinolone 4mg usa

  67. Ulsqhu说道:

    free poker games augmentin 1000mg without prescription levothyroxine online buy

  68. Fnyifa说道:

    live blackjack casino slot free ivermectin 90 mg

  69. Ghoaly说道:

    amantadine 100mg pills symmetrel price dapsone where to buy

  70. Vuzztd说道:

    online money poker monodox medication albuterol pill

  71. Umdhbe说道:

    cost pantoprazole buy zestril 5mg without prescription buy pyridium 200mg online cheap

  72. Xtfmnp说道:

    casino online games global poker online buy furosemide pills for sale

  73. Ueagos说道:

    azithromycin 500mg over the counter buy gabapentin medication buy neurontin tablets

  74. Fstbrr说道:

    buy generic lipitor 10mg buy albuterol for sale brand norvasc

  75. Mozvba说道:

    isotretinoin for sale online zithromax pills how to get zithromax without a prescription

  76. Bkgtbz说道:

    order modafinil pill buy promethazine 25mg generic order deltasone 20mg without prescription

  77. Etmqlp说道:

    omnicef price generic glycomet buy prevacid without a prescription

  78. Ilhjfg说道:

    order cenforce 50mg without prescription order cenforce 50mg online cheap brand chloroquine

  79. Tljcpn说道:

    cialis online canada overnight cialis delivery viagra 50mg brand

  80. Ywrqlg说道:

    buy premarin 600 mg without prescription buy viagra 50mg pill sildenafil order

  81. Wiqsww说道:

    buy omeprazole for sale metoprolol 50mg drug purchase lopressor without prescription

  82. Rwfxwf说道:

    order betahistine 16mg online cost betahistine probenecid 500 mg sale

  83. Arvcbv说道:

    where can i buy latanoprost purchase zovirax for sale order rivastigmine 3mg sale

  84. Qfxyec说道:

    order mestinon 60mg sale feldene 20 mg sale how to get maxalt without a prescription

  85. Qlxxen说道:

    buy ferrous sulfate pills order actonel 35 mg online cheap buy sotalol 40mg generic

  86. Htsgzo说道:

    prasugrel 10 mg drug buy tolterodine 2mg for sale order detrol 2mg online

  87. Ixabur说道:

    etodolac 600 mg price colospa over the counter order generic pletal

  88. Puswzm说道:

    florinef tablet fludrocortisone 100mcg generic buy cheap imodium

  89. Lvintn说道:

    dydrogesterone 10mg cost dydrogesterone for sale online empagliflozin pills

  90. Vaekcp说道:

    purchase melatonin generic danazol 100 mg uk danazol 100 mg drug

  91. Uhywcc说道:

    oral dipyridamole 100mg pravachol drug generic pravachol

  92. Qmaogp说道:

    aspirin 75mg pills aspirin canada imiquimod sale

  93. Fyeudo说道:

    buy precose for sale fulvicin online order fulvicin brand

  94. Cmlnkn说道:

    minoxytop for sale online best erection pills ed pills comparison

  95. Ahyqzm说道:

    overnight cialis delivery buy sildenafil without prescription sildenafil mail order us

  96. Uqeokf说道:

    zaditor 1 mg us geodon 80mg for sale purchase imipramine

  97. Nwouem说道:

    fenofibrate 200mg cost cheap fenofibrate order tricor sale

发表回复

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