SQL Exercises: Display a given string
SQL Basic Select Statement: Exercise-2 with Solution
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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/sql-exercises/sql-retrieve-exercise-2.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics