SQL Column Computation.

How to create columns Computations in the Query Results.

The select_list is the place where you can create computations that you want to be performed on any of the numeric data or constants.

Symbols to use for this:
Symbol Operation
+ addition
- subtraction
/ division
* multiplication
Example:
MySQL, Oracle, SQL server, PostgreSQL:
select Order_ID as "Order", ISBN_no as "ISBN",
       Item_qty "Quantity", price "Price", Item_qty*price "Product" from order_BOOKS
       where order_ID=70001;
The result should be:
Order ISBN Quantity Price Product
70001 0201703092 2 39 78
70001 0764557599 1 42 42
70001 1861002025 5 38 190
70001 1861006314 2 29 58
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.