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.
- Skill level:
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.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for