1.opérations d'addition, de soustraction, de multiplication et de division mysql :
mysql> select score,score+5,score-5,score*5,score/5 from 4a; +-------+---------+---------+---------+---------+ | score | score+5 | score-5 | score*5 | score/5 | +-------+---------+---------+---------+---------+ | 93 | 98 | 88 | 465 | 18.6000 | | 35 | 40 | 30 | 175 | 7.0000 | | 46 | 51 | 41 | 230 | 9.2000 | | 56 | 61 | 51 | 280 | 11.2000 | | 79 | 84 | 74 | 395 | 15.8000 | | 91 | 96 | 86 | 455 | 18.2000 | | 53 | 58 | 48 | 265 | 10.6000 | | 56 | 61 | 51 | 280 | 11.2000 | | 58 | 63 | 53 | 290 | 11.6000 | | 68 | 73 | 63 | 340 | 13.6000 | | 71 | 76 | 66 | 355 | 14.2000 | | 93 | 98 | 88 | 465 | 18.6000 | | 67 | 72 | 62 | 335 | 13.4000 | | 78 | 83 | 73 | 390 | 15.6000 | | 88 | 93 | 83 | 440 | 17.6000 | | 90 | 95 | 85 | 450 | 18.0000 | | 92 | 97 | 87 | 460 | 18.4000 | | 47 | 52 | 42 | 235 | 9.4000 | | 68 | 73 | 63 | 340 | 13.6000 | | 78 | 83 | 73 | 390 | 15.6000 | | 81 | 86 | 76 | 405 | 16.2000 | | 88 | 93 | 83 | 440 | 17.6000 | +-------+---------+---------+---------+---------+ 22 rows in set (0.00 sec)
2.opération de reste mysql :
mysql> select score,score%5 from 4a; +-------+---------+ | score | score%5 | +-------+---------+ | 93 | 3 | | 35 | 0 | | 46 | 1 | | 56 | 1 | | 79 | 4 | | 91 | 1 | | 53 | 3 | | 56 | 1 | | 58 | 3 | | 68 | 3 | | 71 | 1 | | 93 | 3 | | 67 | 2 | | 78 | 3 | | 88 | 3 | | 90 | 0 | | 92 | 2 | | 47 | 2 | | 68 | 3 | | 78 | 3 | | 81 | 1 | | 88 | 3 | +-------+---------+ 22 rows in set (0.00 sec)
3.opération de moyenne mysql :
mysql> select score,avg(score) from 4a; +-------+------------+ | score | avg(score) | +-------+------------+ | 93 | 71.6364 | +-------+------------+ 1 row in set (0.00 sec)
Opération 4.mysql pour savoir si elle n'est pas égale à une certaine valeur :
mysql> select score,score!=88 from 4a; +-------+-----------+ | score | score!=88 | +-------+-----------+ | 93 | 1 | | 35 | 1 | | 46 | 1 | | 56 | 1 | | 79 | 1 | | 91 | 1 | | 53 | 1 | | 56 | 1 | | 58 | 1 | | 68 | 1 | | 71 | 1 | | 93 | 1 | | 67 | 1 | | 78 | 1 | | 88 | 0 | | 90 | 1 | | 92 | 1 | | 47 | 1 | | 68 | 1 | | 78 | 1 | | 81 | 1 | | 88 | 0 | +-------+-----------+ 22 rows in set (0.00 sec)
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!