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)
buy furosemide 40mg online order doxycycline 200mg pill ventolin inhalator canada
buy lexapro 10mg for sale buy lexapro online cheap naltrexone 50mg us
buy cheap strattera order generic quetiapine 50mg buy zoloft online
ursodiol 150mg pill buy cetirizine pill zyrtec where to buy
buy azithromycin paypal buy azithromycin 250mg sale buy neurontin without a prescription
single use heartburn medication fast acting otc heartburn medicine causes of excessive smelly flatulence
buy deltasone 20mg online cheap accutane 20mg without prescription amoxicillin 1000mg over the counter
planned parenthood book online appointment boots order contraceptive pill exercises to increase ejaculation time
buy phenergan for sale buy generic promethazine stromectol for lice
erosive gastritis pictures cystitis remedies over the counter over counter drug for uti
order cymbalta 40mg sale buy cheap generic glucotrol provigil without prescription
supplements that kill candida prescription strength antifungal cream list of high blood medications
periactin 4 mg oral order luvox without prescription where to buy ketoconazole without a prescription
shingles over the counter treatment best way to treat herpes insulin pills instead of injections
medroxyprogesterone 10mg oral praziquantel online buy hydrochlorothiazide 25mg online cheap
nhs stop smoking clinic buy painkillers without an rx pain medication over the counter
buy cheap letrozole cheap albendazole order aripiprazole online
sleeping pills to buy online virtual weight loss doctor weight loss medication prescribed online
order minomycin sale ropinirole usa order requip 2mg without prescription
how to buy uroxatral antihistamine nasal spray canada strongest medicine for gerd
order clonidine 0.1mg without prescription order meclizine 25 mg online cheap purchase spiriva without prescription
best acne treatment teenage guys trileptal usa buy trileptal 600mg for sale
trimox without prescription clarithromycin online buy biaxin 250mg brand
order rocaltrol 0.25mg online where can i buy rocaltrol fenofibrate over the counter
order an essay online online slots real money online roulette for real money
buy a essay online literature essays suprax brand
aspirin 75mg canada online casino slots free slot games no download
desyrel 50mg cost desyrel 100mg usa purchase clindac a sale
order cefuroxime pill cefuroxime for sale online buy robaxin sale
tadacip 20mg cost buy voltaren 50mg order indocin sale
order tretinoin cream for sale cheap retin cream buy avana 100mg
cleocin medication erythromycin uk buy sildenafil pills
buy lamictal 200mg lamotrigine sale order vermox without prescription
order metronidazole 200mg without prescription buy trimethoprim paypal order keflex 250mg
fluconazole 100mg for sale cheap acillin buy cipro
buy essay now buy cheap essays online my childhood essay writing
order spironolactone 100mg buy generic valacyclovir online finasteride oral
oral motilium brand carvedilol buy sumycin 500mg pills
buy flomax 0.2mg buy simvastatin for sale simvastatin 20mg uk
order buspar online order zetia 10mg pills buy amiodarone generic
buy ranitidine 300mg buy generic celecoxib 200mg celecoxib 100mg generic
cheap allopurinol 100mg crestor 10mg us buy rosuvastatin paypal
sumatriptan 50mg brand buy avodart 0.5mg for sale avodart over the counter
nexium 20mg tablet buy nexium pills for sale topamax 100mg sale
astelin online buy zovirax 800mg price buy avapro pills
purchase xenical pill orlistat 120mg tablet buy diltiazem generic
order coumadin 2mg pills cost paroxetine 10mg reglan usa
glimepiride 4mg cost glimepiride sale buy etoricoxib 120mg for sale
buy generic pamelor 25 mg buy methotrexate 10mg generic buy acetaminophen 500mg for sale
generic inderal 10mg buy inderal generic buy clopidogrel 150mg for sale
order fosamax 35mg generic order generic furadantin furadantin 100 mg tablet
order baclofen 25mg where can i buy ketorolac buy ketorolac medication
buy claritin without prescription ramipril for sale online buy priligy online cheap
purchase lioresal pills buy lioresal pill toradol 10mg pills
buy aceon 4mg generic desloratadine 5mg uk generic fexofenadine
dilantin 100 mg cheap phenytoin us buy cheap ditropan
buy levitra 20mg generic buy cheap generic vardenafil buy tizanidine 2mg online
methylprednisolone 16mg online medrol 8mg oral buy triamcinolone 4mg online cheap
serophene cost isosorbide brand buy azathioprine pills for sale
play online blackjack real money online roulette free cheap synthroid pill
symmetrel 100 mg ca atenolol 50mg tablet avlosulfon 100mg pills
blackjack online money order stromectol generic ivermectin 3 mg tabs
protonix 20mg without prescription order lisinopril 10mg pills order phenazopyridine 200mg
slot game cost doxycycline 200mg buy ventolin inhalator online cheap
play blackjack online internet roulette order furosemide sale
buy atorvastatin 10mg sale buy amlodipine tablets buy norvasc online cheap
azipro 250mg price oral omnacortil 20mg neurontin 800mg uk
buy accutane 20mg generic amoxil online order buy generic zithromax
order cefdinir online order cefdinir 300 mg online buy generic prevacid for sale
order cenforce 100mg generic buy generic naprosyn order chloroquine 250mg without prescription
buy micardis generic order molnupiravir 200 mg online cheap molnupiravir 200mg usa
order tadalafil 5mg sale order viagra buy sildenafil 100mg sale
purchase omeprazole generic generic omeprazole 10mg buy lopressor 100mg for sale
premarin 0.625mg brand buy premarin 600 mg generic buy sildenafil tablets
zovirax for sale online latanoprost online buy rivastigmine 6mg online
order enalapril 10mg generic enalapril 10mg sale buy duphalac sale
ferrous sulfate 100mg over the counter order generic sotalol 40 mg order betapace online
buy cheap generic mestinon brand maxalt maxalt brand
order prasugrel 10mg pills generic detrol 1mg order generic tolterodine 1mg
buy monograph 600 mg online cheap buy mebeverine 135mg online cheap order cilostazol 100 mg
buy florinef 100mcg online cheap buy dulcolax 5 mg without prescription loperamide usa
buy duphaston 10 mg online cheap buy dydrogesterone pills where can i buy empagliflozin
dipyridamole 100mg brand order pravachol pills buy generic pravachol
buy meloset online buy danazol pills buy danazol 100mg pills
oral aspirin 75mg hydroquinone medication buy imiquad
buy precose without prescription precose 50mg cheap buy fulvicin 250mg generic
minoxytop without prescription generic minoxidil ed pills that work
buy ketotifen 1mg for sale buy doxepin 75mg pills buy tofranil 75mg generic
tadalafil 10mg canada female viagra sildenafil viagra 100mg sale
buy fenofibrate paypal brand tricor 200mg fenofibrate 160mg without prescription