MySQL Avg()函数

MySQL Avg()函数

MySQL的AVG函数用来查找各种记录的一个字段的平均值。

为了理解AVG函数,考虑有一个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)

现在,假设在上述表的基础上计算所有dialy_typing_pages的平均值,那么可以使用下面的命令:

mysql> SELECT AVG(daily_typing_pages)
    -> FROM employee_tbl;
+-------------------------+
| AVG(daily_typing_pages) |
+-------------------------+
|                230.0000 |
+-------------------------+
1 row in set (0.03 sec)

使用 GROUP BY 子句设置各种记录的平均值。下面的例子将涉及到单个人的记录将有每个人的平均值打印出来。

mysql> SELECT name, AVG(daily_typing_pages)
    -> FROM employee_tbl GROUP BY name;
+------+-------------------------+
| name | AVG(daily_typing_pages) |
+------+-------------------------+
| Jack |                135.0000 |
| Jill |                220.0000 |
| John |                250.0000 |
| Ram  |                220.0000 |
| Zara |                325.0000 |
+------+-------------------------+
5 rows in set (0.20 sec)

90 Responses

  1. Piucww说道:

    buy furosemide 40mg online order doxycycline 200mg pill ventolin inhalator canada

  2. Wrnngv说道:

    buy lexapro 10mg for sale buy lexapro online cheap naltrexone 50mg us

  3. Ebzmdf说道:

    buy cheap strattera order generic quetiapine 50mg buy zoloft online

  4. Limyah说道:

    ursodiol 150mg pill buy cetirizine pill zyrtec where to buy

  5. Ilpefk说道:

    buy azithromycin paypal buy azithromycin 250mg sale buy neurontin without a prescription

  6. Jmoajy说道:

    single use heartburn medication fast acting otc heartburn medicine causes of excessive smelly flatulence

  7. Bwfgyc说道:

    buy deltasone 20mg online cheap accutane 20mg without prescription amoxicillin 1000mg over the counter

  8. Uzfcis说道:

    planned parenthood book online appointment boots order contraceptive pill exercises to increase ejaculation time

  9. Faggdr说道:

    buy phenergan for sale buy generic promethazine stromectol for lice

  10. Shmebv说道:

    erosive gastritis pictures cystitis remedies over the counter over counter drug for uti

  11. Hionzy说道:

    order cymbalta 40mg sale buy cheap generic glucotrol provigil without prescription

  12. Xgtrqw说道:

    supplements that kill candida prescription strength antifungal cream list of high blood medications

  13. Gpoiui说道:

    periactin 4 mg oral order luvox without prescription where to buy ketoconazole without a prescription

  14. Wfjwjj说道:

    shingles over the counter treatment best way to treat herpes insulin pills instead of injections

  15. Irkvyv说道:

    medroxyprogesterone 10mg oral praziquantel online buy hydrochlorothiazide 25mg online cheap

  16. Wfdnqw说道:

    nhs stop smoking clinic buy painkillers without an rx pain medication over the counter

  17. Ohbzcj说道:

    buy cheap letrozole cheap albendazole order aripiprazole online

  18. Isdtfw说道:

    sleeping pills to buy online virtual weight loss doctor weight loss medication prescribed online

  19. Selfng说道:

    order minomycin sale ropinirole usa order requip 2mg without prescription

  20. Onxtpg说道:

    how to buy uroxatral antihistamine nasal spray canada strongest medicine for gerd

  21. Bbpcqo说道:

    order clonidine 0.1mg without prescription order meclizine 25 mg online cheap purchase spiriva without prescription

  22. Rrtocj说道:

    best acne treatment teenage guys trileptal usa buy trileptal 600mg for sale

  23. Mmdont说道:

    trimox without prescription clarithromycin online buy biaxin 250mg brand

  24. Kciyji说道:

    order rocaltrol 0.25mg online where can i buy rocaltrol fenofibrate over the counter

  25. Ptkwem说道:

    order an essay online online slots real money online roulette for real money

  26. Oemqng说道:

    buy a essay online literature essays suprax brand

  27. Dicxye说道:

    aspirin 75mg canada online casino slots free slot games no download

  28. Lijqyb说道:

    desyrel 50mg cost desyrel 100mg usa purchase clindac a sale

  29. Iptsas说道:

    order cefuroxime pill cefuroxime for sale online buy robaxin sale

  30. Ppjhub说道:

    tadacip 20mg cost buy voltaren 50mg order indocin sale

  31. Kurnzd说道:

    order tretinoin cream for sale cheap retin cream buy avana 100mg

  32. Pxtemi说道:

    cleocin medication erythromycin uk buy sildenafil pills

  33. Qitpwc说道:

    buy lamictal 200mg lamotrigine sale order vermox without prescription

  34. Qqbhno说道:

    order metronidazole 200mg without prescription buy trimethoprim paypal order keflex 250mg

  35. Jnybnu说道:

    fluconazole 100mg for sale cheap acillin buy cipro

  36. Mfgkah说道:

    buy essay now buy cheap essays online my childhood essay writing

  37. Toopsc说道:

    order spironolactone 100mg buy generic valacyclovir online finasteride oral

  38. Votozd说道:

    oral motilium brand carvedilol buy sumycin 500mg pills

  39. Auxnuj说道:

    buy flomax 0.2mg buy simvastatin for sale simvastatin 20mg uk

  40. Blfbyk说道:

    order buspar online order zetia 10mg pills buy amiodarone generic

  41. Juwvec说道:

    buy ranitidine 300mg buy generic celecoxib 200mg celecoxib 100mg generic

  42. Jjyxsi说道:

    cheap allopurinol 100mg crestor 10mg us buy rosuvastatin paypal

  43. Ufdxmh说道:

    sumatriptan 50mg brand buy avodart 0.5mg for sale avodart over the counter

  44. Fjooxz说道:

    nexium 20mg tablet buy nexium pills for sale topamax 100mg sale

  45. Xohpjk说道:

    astelin online buy zovirax 800mg price buy avapro pills

  46. Ifuqdh说道:

    purchase xenical pill orlistat 120mg tablet buy diltiazem generic

  47. Glmiof说道:

    order coumadin 2mg pills cost paroxetine 10mg reglan usa

  48. Wjfjwt说道:

    glimepiride 4mg cost glimepiride sale buy etoricoxib 120mg for sale

  49. Dotjnr说道:

    buy generic pamelor 25 mg buy methotrexate 10mg generic buy acetaminophen 500mg for sale

  50. Zcaizl说道:

    generic inderal 10mg buy inderal generic buy clopidogrel 150mg for sale

  51. Oeyhph说道:

    order fosamax 35mg generic order generic furadantin furadantin 100 mg tablet

  52. Ifalbq说道:

    order baclofen 25mg where can i buy ketorolac buy ketorolac medication

  53. Lbgdeb说道:

    buy claritin without prescription ramipril for sale online buy priligy online cheap

  54. Eoonfe说道:

    purchase lioresal pills buy lioresal pill toradol 10mg pills

  55. Tcrpyi说道:

    buy aceon 4mg generic desloratadine 5mg uk generic fexofenadine

  56. Skzkrw说道:

    dilantin 100 mg cheap phenytoin us buy cheap ditropan

  57. Kcsatc说道:

    buy levitra 20mg generic buy cheap generic vardenafil buy tizanidine 2mg online

  58. Nyqalb说道:

    methylprednisolone 16mg online medrol 8mg oral buy triamcinolone 4mg online cheap

  59. Pewcnx说道:

    serophene cost isosorbide brand buy azathioprine pills for sale

  60. Hhyzmu说道:

    play online blackjack real money online roulette free cheap synthroid pill

  61. Wyvapa说道:

    symmetrel 100 mg ca atenolol 50mg tablet avlosulfon 100mg pills

  62. Vzavlt说道:

    blackjack online money order stromectol generic ivermectin 3 mg tabs

  63. Hertrd说道:

    protonix 20mg without prescription order lisinopril 10mg pills order phenazopyridine 200mg

  64. Cudjzv说道:

    slot game cost doxycycline 200mg buy ventolin inhalator online cheap

  65. Episiv说道:

    play blackjack online internet roulette order furosemide sale

  66. Usalhw说道:

    buy atorvastatin 10mg sale buy amlodipine tablets buy norvasc online cheap

  67. Dpgxho说道:

    azipro 250mg price oral omnacortil 20mg neurontin 800mg uk

  68. Cyvirf说道:

    buy accutane 20mg generic amoxil online order buy generic zithromax

  69. Wwuuku说道:

    order cefdinir online order cefdinir 300 mg online buy generic prevacid for sale

  70. Lfqzrq说道:

    order cenforce 100mg generic buy generic naprosyn order chloroquine 250mg without prescription

  71. Zijhoy说道:

    buy micardis generic order molnupiravir 200 mg online cheap molnupiravir 200mg usa

  72. Rmwuto说道:

    order tadalafil 5mg sale order viagra buy sildenafil 100mg sale

  73. Igqque说道:

    purchase omeprazole generic generic omeprazole 10mg buy lopressor 100mg for sale

  74. Awzqfk说道:

    premarin 0.625mg brand buy premarin 600 mg generic buy sildenafil tablets

  75. Ealblh说道:

    zovirax for sale online latanoprost online buy rivastigmine 6mg online

  76. Ngkkpg说道:

    order enalapril 10mg generic enalapril 10mg sale buy duphalac sale

  77. Mjqroe说道:

    ferrous sulfate 100mg over the counter order generic sotalol 40 mg order betapace online

  78. Iiycqd说道:

    buy cheap generic mestinon brand maxalt maxalt brand

  79. Kjpoui说道:

    order prasugrel 10mg pills generic detrol 1mg order generic tolterodine 1mg

  80. Yaixpx说道:

    buy monograph 600 mg online cheap buy mebeverine 135mg online cheap order cilostazol 100 mg

  81. Lxaxqz说道:

    buy florinef 100mcg online cheap buy dulcolax 5 mg without prescription loperamide usa

  82. Exnoom说道:

    buy duphaston 10 mg online cheap buy dydrogesterone pills where can i buy empagliflozin

  83. Sivpuc说道:

    dipyridamole 100mg brand order pravachol pills buy generic pravachol

  84. Zramts说道:

    buy meloset online buy danazol pills buy danazol 100mg pills

  85. Mwcwij说道:

    oral aspirin 75mg hydroquinone medication buy imiquad

  86. Ytfkms说道:

    buy precose without prescription precose 50mg cheap buy fulvicin 250mg generic

  87. Tlamhr说道:

    minoxytop without prescription generic minoxidil ed pills that work

  88. Kvjwcz说道:

    buy ketotifen 1mg for sale buy doxepin 75mg pills buy tofranil 75mg generic

  89. Lmenjg说道:

    tadalafil 10mg canada female viagra sildenafil viagra 100mg sale

  90. Bjyjke说道:

    buy fenofibrate paypal brand tricor 200mg fenofibrate 160mg without prescription

发表评论

您的电子邮箱地址不会被公开。

CAPTCHAis initialing...