w3resource

SQL Exercises: Display the numbers in columns

SQL Basic Select Statement: Exercise-3 with Solution

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

Sample Solution:

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


Practice Online


Query Visualization:

Duration:

Query visualization of Display numbers in columns - Duration

Rows:

Query visualization of Display numbers in columns - Rows

Cost:

Query visualization of Display numbers in columns - Cost

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

Previous SQL Exercise: Display a given string.
Next SQL Exercise: Display the sum of two numbers.

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.

SQL: Tips of the Day

What's the difference between VARCHAR and CHAR?

VARCHAR is variable-length.

CHAR is fixed length.

If your content is a fixed size, you'll get better performance with CHAR.

Ref: https://bit.ly/3wl3ram

 





We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook