Reputation: 77
Im a beginner and I would like to ask how to get the 20% of the Rates Column Values (The Mysql Syntax for this) . How can I make another column using SELECT statement where the values are 20% of the Rates.
+-------------------+----------------------+------+
| Fullname | position | rate |
+-------------------+----------------------+------+
| terry, sanchez | Web Developer | 1500 |
| bernie, nahoma | Web Developer | 1500 |
| marie, viray | Web Developer | 1500 |
| lucy, dante | Web Developer | 1500 |
| benedict, cruz | Web Developer | 1500 |
| jhon paul, arroyo | Web Designer | 1200 |
| lewis, abante | Web Designer | 1200 |
| lito, lapid | Database Administrat | 1350 |
| jerwin, aton | Project Manager | 2000 |
| benjie, cruz | Dev Ops | 1250 |
+-------------------+----------------------+------+
Upvotes: 0
Views: 115
Reputation: 19
select rates, (select (rates * 20) / 100) as percentage from table
This will give you desried result. selecting rates as the first column is totaly optional.
Upvotes: 1
Reputation: 1966
select (0.2 * rate) as 20_percent_rate, rate from table
This should work for you.
Upvotes: 1