How to Multiply Columns in SQL

Written by bennett gavrish | 13/05/2017
How to Multiply Columns in SQL
You can write SQL statements that will multiply data in two or more columns. (Thinkstock Images/Comstock/Getty Images)

SQL databases support all standard mathematical operations, including the ability to multiply data from one column with data from a second column or field. The only requirement for multiplication between columns of data in an SQL table is that both fields involved must contain integers or decimals. When you write a select statement to perform the multiplication between columns, the database stores the results of the operation in a separate field.

Create a new SQL statement in your database application.

Type "SELECT (Column 1 * Column 2)" and replace "Column1" and "Column2" with the names of the fields or columns you want to multiply.

Add "AS (Newfield)" to your SQL statement and replace the word "NewField" with the name you want to use for the new column where the results of the multiplication will be stored.

Complete the SQL statement by typing "FROM (TableName);" and replacing "TableName" with the name of the database table the contains the columns you are using.

Run the SQL statement to perform the multiplication for each record in the table and place the results in the new field you defined in Step 3.

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.