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)

93 Responses

  1. Gfivpc说道:

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

  2. Dbroke说道:

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

  3. Yhbvjj说道:

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

  4. Ipuneu说道:

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

  5. Xvhngy说道:

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

  6. Ermwzj说道:

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

  7. Vtcljf说道:

    deltasone 40mg generic amoxicillin canada order generic amoxicillin

  8. Rzgmng说道:

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

  9. Vxqqdt说道:

    purchase phenergan sale buy phenergan pills stromectol 3mg cost

  10. Kesywv说道:

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

  11. Acyedo说道:

    duloxetine 20mg over the counter duloxetine brand provigil generic

  12. Mxkdox说道:

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

  13. Xdureg说道:

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

  14. Ssbclc说道:

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

  15. Yohkma说道:

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

  16. Iiprip说道:

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

  17. Wvldsq说道:

    purchase femara order albenza online cheap abilify 30mg us

  18. Whhwms说道:

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

  19. Pacgpx说道:

    buy minocin pill minocin usa buy ropinirole pills

  20. Vaccsq说道:

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

  21. Gqfbgw说道:

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

  22. Ludmnk说道:

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

  23. Azltdx说道:

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

  24. Jaatol说道:

    practice essay writing online best online casino free poker games

  25. Vzeulg说道:

    professional letter writing services science article reviews cefixime for sale online

  26. Kfjpaj说道:

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

  27. Cknejc说道:

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

  28. Bpspst说道:

    how to buy trazodone buy clindac a cheap buy clindamycin cheap

  29. Zwpbzr说道:

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

  30. Gzwlak说道:

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

  31. Tcavie说道:

    buy nolvadex paypal order symbicort generic budesonide cost

  32. Rpchrw说道:

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

  33. Wgssle说道:

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

  34. Uhzyyz说道:

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

  35. Jlbfny说道:

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

  36. Dgetxk说道:

    diflucan canada fluconazole buy online buy ciprofloxacin medication

  37. Ytxcft说道:

    order aurogra 50mg online oral sildalis buy estradiol no prescription

  38. Awrsnt说道:

    aldactone ca brand spironolactone 100mg order finasteride sale

  39. Ofitox说道:

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

  40. Fbyzet说道:

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

  41. Zmuxqb说道:

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

  42. Njljqc说道:

    zantac price mobic pills buy celebrex online

  43. Rueoxd说道:

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

  44. Vsnvdb说道:

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

  45. Xznzcg说道:

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

  46. Oshqji说道:

    buy esomeprazole cheap buy nexium generic buy generic topamax

  47. Ndkjko说道:

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

  48. Xulzsp说道:

    astelin 10 ml ca avalide order irbesartan canada

  49. Mexnlp说道:

    buy warfarin maxolon medication reglan tablet

  50. Ozxmpj说道:

    buy cheap orlistat buy mesalamine order diltiazem 180mg online cheap

  51. Wjcmob说道:

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

  52. Dflmjc说道:

    buy propranolol online clopidogrel medication clopidogrel cost

  53. Ebyygq说道:

    alendronate pill nitrofurantoin 100 mg tablet nitrofurantoin us

  54. Msgbja说道:

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

  55. Xcwbxq说道:

    buy lioresal sale ketorolac without prescription buy toradol 10mg pill

  56. Upyhvd说道:

    baclofen pills buy baclofen pills buy cheap ketorolac

  57. Hhwwoe说道:

    purchase loratadine pills buy priligy online order dapoxetine 90mg online

  58. Qrvmtw说道:

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

  59. Tjyluo说道:

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

  60. Kjcuzk说道:

    buy clomiphene generic order imdur sale purchase imuran generic

  61. Mahhea说道:

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

  62. Ulsqhu说道:

    free poker games augmentin 1000mg without prescription levothyroxine online buy

  63. Fnyifa说道:

    live blackjack casino slot free ivermectin 90 mg

  64. Ghoaly说道:

    amantadine 100mg pills symmetrel price dapsone where to buy

  65. Vuzztd说道:

    online money poker monodox medication albuterol pill

  66. Umdhbe说道:

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

  67. Xtfmnp说道:

    casino online games global poker online buy furosemide pills for sale

  68. Ueagos说道:

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

  69. Fstbrr说道:

    buy generic lipitor 10mg buy albuterol for sale brand norvasc

  70. Mozvba说道:

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

  71. Bkgtbz说道:

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

  72. Etmqlp说道:

    omnicef price generic glycomet buy prevacid without a prescription

  73. Ilhjfg说道:

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

  74. Tljcpn说道:

    cialis online canada overnight cialis delivery viagra 50mg brand

  75. Ywrqlg说道:

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

  76. Wiqsww说道:

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

  77. Rwfxwf说道:

    order betahistine 16mg online cost betahistine probenecid 500 mg sale

  78. Arvcbv说道:

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

  79. Qfxyec说道:

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

  80. Qlxxen说道:

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

  81. Htsgzo说道:

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

  82. Ixabur说道:

    etodolac 600 mg price colospa over the counter order generic pletal

  83. Puswzm说道:

    florinef tablet fludrocortisone 100mcg generic buy cheap imodium

  84. Lvintn说道:

    dydrogesterone 10mg cost dydrogesterone for sale online empagliflozin pills

  85. Vaekcp说道:

    purchase melatonin generic danazol 100 mg uk danazol 100 mg drug

  86. Uhywcc说道:

    oral dipyridamole 100mg pravachol drug generic pravachol

  87. Qmaogp说道:

    aspirin 75mg pills aspirin canada imiquimod sale

  88. Fyeudo说道:

    buy precose for sale fulvicin online order fulvicin brand

  89. Cmlnkn说道:

    minoxytop for sale online best erection pills ed pills comparison

  90. Ahyqzm说道:

    overnight cialis delivery buy sildenafil without prescription sildenafil mail order us

  91. Uqeokf说道:

    zaditor 1 mg us geodon 80mg for sale purchase imipramine

  92. Nwouem说道:

    fenofibrate 200mg cost cheap fenofibrate order tricor sale

发表回复

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

CAPTCHAis initialing...