w3resource

SQL Exercises: Display the numbers in columns


3. Display Three Numbers

Write a SQL query to display three numbers in three columns.

Sample Solution:

-- This query selects three numeric literals (5, 10, and 15) as separate columns.
SELECT 5, 10, 15;

Output of the Query:

?column?
15

:Code Explanation:

The above query in SQL that selects a row with three columns, each with a different value: 5, 10, and 15. These values will be in a single row and multiple columns.

Syntax of display numbers in columns

Visual presentation:

Result of display numbers in columns


Go to:


PREV : Display a Custom String.
NEXT : Sum of Two Numbers.


Practice Online



For more Practice: Solve these Related Problems:

  • Write a SQL query to display three numbers: 10, 20, and 30 in separate columns.
  • Write a SQL query to show the numbers 5, 15, and 25 in three different columns.
  • Write a SQL query to display the values 7, 14, and 21 in three distinct columns.
  • Write a SQL query to output the numbers 100, 200, and 300 in separate columns.


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

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.