Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Operator RSS Feeds

Examples of * ( Multiply ) Operator

Posted By: Sarita Patel     Category: SQL Server     Views: 12766

This article describes *( Multiply ) operator with different examples.

Multiply operator is used to perform multiplication of any numeric type fields except datetime in sql server.

Syntax of * ( Multiply ) Operators : 

expression * expression

Expression is any valid expression of the numeric data type except datetime data type in sql server.


Example of  * ( Multiply ) Operator :

Example 1 : Displays use of multiplication for numeric numbers.

SELECT 3*4

Output
12

Above example explains how can we use multiplication operator for numeric numbers.




Example 2 : Example of multiplying digit with table field.

SELECT ProductName, UnitPrice * 2  AS Price
FROM Products

Output
ProductName                               Price
Chai  36.00
Chang  38.00
Aniseed Syrup  20.00
Chef Anton's Cajun Seasoning  44.00
Chef Anton's Gumbo Mix  42.70

Above example displays how can we use multiplication operator with table field UnitPrice and numeric number 2.




Example 3 : Example of multiplying 2 fields of tables. 

SELECT ProductName, UnitsInStock * UnitPrice AS TotalCostOfEachProduct
FROM Products

Output
ProductName                            TotalCostOfEachProduct
Chai  702
Chang 
323
Aniseed Syrup 
130
Chef Anton's Cajun Seasoning 
1166
Chef Anton's Gumbo Mix  0

Above example displays total cost of each product by multiplying UnitInStock and UnitPrice fields of products table.  

  
Share: 


Didn't find what you were looking for? Find more on Examples of * ( Multiply ) Operator Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of Examples of * ( Multiply ) Operator is from United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!