w3resource

SQL Exercises: Display a given string


2. Display a Custom String

Write a query to display a string "This is SQL Exercise, Practice and Solution".

Sample Solution:

-- This query selects a string literal as a single column result.
SELECT "This is SQL Exercise, Practice and Solution";

Output of the Query:

?column?
This is SQL Exercise, Practice and Solution

Code Explanation:

The query in SQL that selects a string or a text "This is SQL Exercise, Practice and Solution" as a single column and single row.


Practice Online



Note: You can use literal string (enclosed in single or double quotation mark) just like we use a column name in the SELECT statement. If you use the literal string with a column then it will be displayed in every row of the query results.

Syntax of display a given string

Visual presentation:

Result of display a given string

Go to:


PREV : Display All Salespeople.
NEXT : Display Three Numbers.

For more Practice: Solve these Related Problems:

  • Write a SQL query to display the string "Welcome to SQL Practice Exercises".
  • Write a SQL query to output the text "Database Management is Fun!".
  • Write a SQL query to print the phrase "Learning SQL Queries Made Easy".
  • Write a SQL query to display the message "Practice Makes Perfect in SQL".


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.