How to Multiply to Fields in SQL

The Microsoft SQL "update" statement provides developers with the ability to multiply numbers and insert the results to a table field. You can use this process to calculate data you want to keep in a table such as an order total or the number of times a customer places an order. The asterisk symbol represents a multiplication procedure in the SQL language.

Instructions

    • 1

      Open the Microsoft SQL Server Management database programming software from the Windows program menu. Type your username and password into the log-in screen.

    • 2

      Click the database name you want to edit. Click "Tables" and view the table name in which you want to store the multiplication results.

    • 3

      Create the SQL statement that stores the multiplication query results. For instance, the following code stores the multiplication results in the field named "ordertotal" in a table named "orders":

      update orders
      set ordertotal = quantity*price
      where order = 22

      This example inserts the multiplication value of the price and quantity into the ordertotal field. The update query is only executed against the record number 22. If you do not add the "where" clause, the entire table's data is changed.

    • 4

      Click the "Run" button to execute the statement on the table. A success message returns after the update completes.

Related Searches:

References

Comments

Related Ads

Featured