w3resource

SQL Exercises: Display the sum of two numbers


Write a SQL query to display the sum of two numbers 10 and 15 from the RDBMS server.

Sample Solution:

-- This query performs addition of two numeric literals (10 and 15).
SELECT 10 + 15;

Output of the Query:

?column?
25

Code Explanation:

The above SQL query that selects a column with a single row, which contains the result of the mathematical expression 10 + 15 = 25.

Syntax of display sum of two numbers

Visual presentation:

Result of the sum of two numbers


Practice Online



For more Practice: Solve these Related Problems:

  • Write a SQL query to calculate the sum of 25 and 35.
  • Write a SQL query to compute the total of 50 and 75.
  • Write a SQL query to find the sum of 120 and 180.
  • Write a SQL query to add the numbers 200 and 300.


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous SQL Exercise: Display the numbers in columns.
Next SQL Exercise: Display the result of an arithmetic expression.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.