SQL Exercises: Display a given 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.
Visual presentation:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous SQL Exercise: Display all information about all salespeople.
Next SQL Exercise: Display the numbers in columns.
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