Instruction
Nice! We may now move on to our next problem: simple mathematics. Can you add or multiply numbers in SQL? Yes, you can! Take a look at the example:
SELECT * FROM User WHERE (MonthlySalary * 12) > 50000;
In the above example, we multiply the monthly salary by 12 to get the annual salary by using the multiplication operator, which happens to be the asterisk symbol (*). We may then do whatever we want with the new value – in this case, we compare it with 50,000.
In this way, you can add (+), subtract (-), multiply (*), and divide (/) numbers.
Exercise
Select all cars with a tax value exceeding 2000. The tax rate for all cars is 20%; you can represent this equivalently as 0.2 in your query. Multiply the price by 0.2 to get the tax value.
Stuck? Here's a hint!
Type:
SELECT * FROM Car WHERE (Price * 0.2) > 2000;



