Mysql operator TIMES
From w3cyberlearnings
Contents |
MySQL Time or Multiplication Function
Return the multiplication of two numbers. {{mysql_ref_syntax|Multiplication}
- N is the first number (must not be 0)
- M is the second number (must not be 0)
N * M
Example 1
mysql> SELECT 4 * 4; +-------+ | 4 * 4 | +-------+ | 16 | +-------+ 1 row in set (0.00 sec)
Example 2
mysql> SELECT * FROM totalearn; +----+------------+-------------+ | id | total_hour | hourly_rate | +----+------------+-------------+ | 1 | 30 | 50 | | 2 | 40 | 50 | | 3 | 30 | 80 | | 4 | 34 | 90 | +----+------------+-------------+ 4 rows in set (0.00 sec) mysql> SELECT id, -> total_hour, -> hourly_rate * total_hour as earned -> FROM totalearn; +----+------------+--------+ | id | total_hour | earned | +----+------------+--------+ | 1 | 30 | 1500 | | 2 | 40 | 2000 | | 3 | 30 | 2400 | | 4 | 34 | 3060 | +----+------------+--------+ 4 rows in set (0.00 sec)
Related Links
# | Function | Description |
---|---|---|
1 | DIV | Integer division |
2 | / | Division operator |
3 | - | Minus operator |
4 | % or MOD | Modulo operator |
5 | + | Addition operator |
6 | * | Multiplication operator |
7 | - | Change the sign of the argument |