How to Multiply in MySQL
It is extremely easy to multiply in MySQL. You basically just use the * operator between two columns in a select statement. This isn’t really specific to MySQL. It just uses basic SQL syntax. Here is a really basic example:
SELECT name, price*quantity
AS total FROM items;
This is assuming you have a table named “items” with the following columns:
- name
- price
- quantity
Here is another example in which we just multiply a column by a number.
SELECT name, price*2
AS total FROM items;
Here we have yet another example where we multiply two columns from different tables.
SELECT p.name, i.price*d.quantity AS total
FROM items i
JOIN distribution d ON d.id=p.d_id;
Video Guide