It is a simple matter to perform calculations in a query. The result of the expression is placed in a new column in the result set. You can give the calculated field a name, too. These calculated fields are sometines called computed columns. Don't confuse them with aggregate functions which do calculations in a sense but don't create a new column in the result set.
Example
Here is a simple example from the bookstore database. (Remember that the use bookstore statement only applies to SQL Server and MySQL. Oracle and Access don't use it.)
No comments:
Post a Comment