SQL Exercises: Display the result of an arithmetic expression
Write an SQL query to display the result of an arithmetic expression.
Sample Solution:
-- This query performs a series of arithmetic operations: addition, subtraction, and multiplication.
SELECT 10 + 15 - 5 * 2;
Output of the Query:
?column? 15
Code Explanation:
The given SQL query that selects a column with a single row, which contains the result of the mathematical expression 10 + (15 - (5 * 2)) = 15.

Visual presentation:

Practice Online
For more Practice: Solve these Related Problems:
- Write a SQL query to evaluate the expression (10 + 20) * 5.
- Write a SQL query to compute the result of (100 - 50) / 2.
- Write a SQL query to calculate the value of (8 + 7) * (6 - 3).
- Write a SQL query to find the result of (50 * 2) - (100 / 4).
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous SQL Exercise: Display the sum of two numbers.
Next SQL Exercise: Select specific columns from a table.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics