Simply select char, or string

What is the way to achieve expected result from psql select:

SELECT 'Hello world';

using this in SQuirreL I get value: in unnamed column. What is the way to get string Hello world as a result?

I want to use this approach to format outputs using commas, colons, etc. Is there another way to pre-prepare results for further usage?

Thanks in advance for any help

Answers


I want get one column with 'Hello word' as its content. Column name is unset here (in squirrel '?column?')

It's because you didn't give that column a name (alias)

If you'll do it like this

SELECT 'Hello world' AS column_name

you'll get

| COLUMN_NAME |
|-------------|
| Hello world |

Here is SQLFiddle demo


This is an old question, but I ran into the same problem with SQuirreL, and found a simple work-around. Try this in SQuirreL:

SELECT trim('Hello world') AS column_name;

Actually, any of the PostgreSQL string functions will work, like upper(), lower(), etc., depending on your needs.


The question is not clear but I give you the possible optionsin one block

begin     declare @PreDefinedVariable nvarchar(50)     Select @PreDefinedVariable = 'Hello World!'     select @PreDefinedVariable as [Result] end


It is an SQuirreL SQL Client issue, using psql from bash I get expected:

tdb14=> SELECT 'Hello world' AS column_name;
 column_name 
-------------
 Hello world
(1 row)

Need Your Help

Compile in Fedora and run on Android

android linux gcc adb fedora

Is it possible to compile a c code in Fedora and to run it on Android with gcc? I tried to compile using gcc file.c -o f1 and it didn't work. Any seggustions? I was unable to execute it with ADB tool.

What are the advantages of installing JDBC Driver as a Module in WildFly

jdbc jboss jboss7.x wildfly wildfly-8

This link explains the new things about WildFly. Under the Migrating The Database Connection -> JDBC Driver the article explains about two ways of using jdbc drivers for the applications. I trie...