Prepare data:
Create Table fruit
("ID" number (4, 0 ),
"Name" varchar2 (50 byte ),
"Price" number (4, 2)
)
Insert into fruit (ID, name, price) values (1, 'apple', 1 );
Insert into fruit (ID, name, price) values (2, 'bana', 2 );
Insert into fruit (ID, name, price) values (3, 'pear ', 3 );
Insert into fruit (ID, name, price) values (4, 'Orange ', 4 );
Commit;
Select * from fruit;
The output is:
ID name Price
1 Apple 1
2 banana 2
3 pear 3
4 orange 4
Now suppose that you want to give a 10% discount to all the fruits, so that these fruits can be sold faster.
So you want to see the discounted price as well, you can select constant as a column, to display what you want:
Select ID, name, price, 0.10 as "discount", price * (1-0.10) as "discounted price" from fruit;
The output is:
ID name price discount discounted price
1 Apple 1 0.1 0.9
2 banana 2 0.1 1.8
3 pear 3 0.1 2.7
4 orange 4 0.1 3.6