Structured Query Language, or SQL, is a relational database programming language. Queries written in SQL can search a database, modify records and even perform arithmetic calculations. To calculate using SQL, two mathematical expressions (such as dividend and divisor, multiplier and multiplicand, minuends or addends) are placed on opposite ends of an arithmetic operator. Each expression must be numeric data.
Open the relational database tool and select “New Database” or “New SQL” from the File menu. Type a SELECT statement to specify which fields in the database are going to be used, such as:
SELECT GreenPopsiclesOnHand, RedPopsiclesOnHand
Press “Enter” to insert a carriage return, type the arithmetic operation you wish to perform and append a description using the “AS” function to the end of the calculated field. For example, to add five green popsicles to the “GreenPopsiclesOnHand” value, type:
GreenPopsiclesOnHand + 5 AS OnHandPlusFiveGreenPopsicles
Select “Run” or “Execute” in the relational database tool.
- The product of two fields can be calculated as well. To add the number of green and red popsicles, the SQL statement would read:
- GreenPopsiclesOnHand + RedPopsiclesOnHand AS TotalPopsiclesOnHand
- searching image by dinostock from Fotolia.com